Issue with column name in export CSV file

Hello, my app needs to generate a CSV file that conforms to a template provided by an external application.   I am having issues with matching column header with the template.

The template requires a column name = ContactName

I have used the same in a column in my table (i.e. ContactName) but have specified the 'Display Name' for this column to be 'Requestor' which is more appropriate in my app.

When I export the data, the CSV file shows the column header as Requestor which would cause problem when the file is imported by the external application.   

I have tried imposing the condition below in the Display Name :

IF(CONTEXT("VIEW") = "Filtered data for export", "ContactName", "Requestor")

The result is in the concerned view, the column header shows correctly "ContactName", however, when the date is exported, the column header in the CSV file continues to show Requestor.

Need help to resolve this please.  Ideas and advise on how to resolve this  would be very much appreciated. 

Thanks. 

 

Solved Solved
0 7 139
1 ACCEPTED SOLUTION

Since the view name does not exist (at least system does not seem to match any name) during CSV export, you should change your expression to something like

 

IF(
 IN(CONTEXT("VIEW"), {"view1",//list other views that you want to see Requestor//}
 ),
 "Requestor"
 "ContactName"
)

 

View solution in original post

7 REPLIES 7

Since the view name does not exist (at least system does not seem to match any name) during CSV export, you should change your expression to something like

 

IF(
 IN(CONTEXT("VIEW"), {"view1",//list other views that you want to see Requestor//}
 ),
 "Requestor"
 "ContactName"
)

 

Thanks.  Just ran a couple of tests with the recommended expression and it worked well.  

As there is only two views that require ContactName (but many uses Requestor), I may need to change the column name to Requestor and apply the expression to change the column name to ContactName during export.  A good lesson learn on table design... haha.

Thanks for your help. 

Hello, I am still struggling with the issue with column name and Display name, I probably have yet to grasp the logic behind Display name.  

I changed the table column name to Requestor (from ContactName) & regenerated the schema.  Then I ran some tests and below is the summary of the actions and results.  My goal is to have the column ContactName in the CSV file (& the 'Filtered data for export' view where I loaded the data with a LINKTOFILTEREDVIEW expression) whilst in all other views the column name should be Requestor.

Column nameDisplay NameResult - column name in CSV fileInvoice item listFiltered data for export
RequestorIF(IN(CONTEXT("VIEW"), {Filtered data for export, Invoice item list}), "ContactName", "Requestor")RequestorContactNameContactName
RequestorIF(IN(CONTEXT("VIEW"), {My invoices, Invoice item list}), "Requestor", "ContactName" )ContactNameRequestorContactName
ContactNameIF(IN(CONTEXT("VIEW"), {Filtered data for export, Invoice item list}), "ContactName", "Requestor")RequestorContactNameContactName
ContactNameIF(IN(CONTEXT("VIEW"), {My invoices, Invoice item list}), "Requestor", "ContactName" )ContactNameRequestorContactName
ContactNameIF(NOT(IN(CONTEXT("VIEW"), {My invoices, Invoice item list})), "ContactName", "Requestor" )ContactNameRequestorContactName
ContactNameIF(NOT(IN(CONTEXT("VIEW"), {Filtered data for export, Finance tools})), "Requestor", "ContactName")RequestorRequestorContactName

** I made sure to regenerate the schema whenever the table column name changed.  The other two views - My invoices, Finance tools - are existing views but don't really use the column concerned,  they are included to complete the List expression.

The tests results seem to indicate the Display name (or the expression in the Display name) takes precedence over the actual column name, hence, I must use an explicit logical expression to indicate the each view (there are many) that should display Requestor if I were to get the CSV file to show ContactName.  Is this the only way to achieve my goal? 

To put the question in another way, what would be the best way to display an alternative column name in a small number of views? 

Comments and advise would be very much appreciated. 

Thanks. 

Ernest

You should probably use CONTEXT("ViewType") instead of  "View" because again CSV export does not match any of the view types.

 

IF(
 NOT(
  IN(
   CONTEXT("VIEWTYPE"),
   {"Table","Form","Detail",....}
  )
 ),
 "ContactName",
 "Requester"
)

https://support.google.com/appsheet/answer/10106772?sjid=16268267847305272211-AP

 

@TeeSee1 Thanks for the prompt response. I did a few quick tests with view type but it seems to offer even less control....

My limited experience with Appsheet tells me that what I see in the view is what I get in the CSV file (export), so I thought as long as I get the desired column name in the concerned view (which is Filtered data for export), the CSV file should have the same info / values.  However, the tests results proved that was not always the case :  the various expression applied in Display name always get the desired column name (i.e. ContactName) in the view where the export operation was carried out (i.e. at Filtered data for export view), but the CSV file could contain a different column name!   Either my understanding on the relationship between 'view' and 'export' is incorrect (most likely the case) or there is a bug in the export operation. 

Again, comments are very welcome, hope to learn more and overcome this problem.  Otherwise I may need resort to build in extra steps to write the records in another table that conforms fully to the import template provided by the external application or have dummy / duplicate columns with the required column names and control the view by a slice for export to CSV file. .

Thanks.

To be honest, there is hardly any documentation on this subject (at least I cannot find any). So you either contact support or play with the system till you get it right or hope someone provides an answer. I myself do not have any special knowledge on this matter and am groping around for a solution just as blindly as you are.

@TeeSee1 Thank you for your response.  Appreciate that the issue needs input from Google support, I'll contact them and see.  In the meantime, I implemented the very first expression recommended by you and that worked just fine.  

Thank you again for your help.

Ernest

Top Labels in this Space