CSV Export View Type

Hi all,

I’m trying to use the CSV actions to help my users import data in bulk. What I’m trying to do is use the CSV export action so that users can download the current data set, review it, add/update it in the CSV file. Then, they can save that file and use the CSV import action to upload all add/updates at once.

Currently, I am having an issue with the key values of the ref columns of the table that I’m using. Unlike this post: Export csv when I use the CSV export action on my table, the CSV file includes the labels of the ref columns, not the keys. This is handy for users to read but if users use the CSV import action with a CSV file that only has the label values, AppSheet won’t recognize the relationship of the those ref columns. I think this is caused by a Valid If expression that I’m using to make the columns alphabetical when chosen from a drop down (such as this: ORDERBY(ContactType[Id],[Name],FALSE). But to be honest I don’t know if that is the case because this expression doesn’t fix it:
IF(
CONTEXT(“ViewType”) = “Form”,
ORDERBY(Company[ID],[Name],FALSE),
ORDERBY(Company[ID], [ID])
)

To address this, I am creating a slice that will be used for CSV export/import actions and will include non-user friendly info such as the record ID’s, the actual column names, and the key values of the ref columns. I was able to display the record ID’s by a combination of using a Show If expression (such as: CONTEXT(“ViewType”)<> “Form”) and removing the column from the Column Order of the related view.

I am also able to display the actual column names by changing the Display Name expression from “First Name” to:
IF(
OR(
CONTEXT(“ViewType”) = “Table”, CONTEXT(“ViewType”) = “Form”, CONTEXT(“ViewType”) = “Detail”),
“First Name”,
“FirstName”
)

All of this info is to ask, what view type is the CSV export? The above expression is able to change the display name to “First Name” in all of the views in my app and change the display name to “FirstName” in the exported CSV file. But I think the expression would be a lot cleaner if I knew which of the these view types the CSV Export action used: View Types | AppSheet Help Center

Also, if you see any other errors in my thought process, please let me know. If my apps were tied to a spreadsheet data source I would probably have users just change it directly but I am using a SQL data source.

0 1 301
1 REPLY 1

Hi @Darmund how are you able to get this done?

"when I use the CSV export action on my table, the CSV file includes the labels of the ref columns, not the keys"

Top Labels in this Space