Automatically change column names, maintained in another table (avoiding monkey tasks)

Hi there,

I have a huge table with at least 200 columns for a questionnaire. Some of these columns are placeholders for Show -> Page_Header columns. As the names of these Page_Headers might change (and not only these), I would like to avoid doing monkey tasks and going into each of these columns and change its "Content" line. Therefore, I am looking for an expression, which I can just put into the "Content" section and it will autmatically update the name. And here I need some help.

The idea was to create a new table (Inspection_Question) where I maintain the names for the Page_Headers. The column "Designation Type" holds the table name of the questionnaire (as I will have several questionnaires), "Question" holds the name of the Page_Header and "Tab" holds the desired name/ content.

Ksenia1_0-1695205075606.png

The formula I was trying was something like

 

SELECT(Inspection_Question[Tab], AND([Designation Type] = CONTEXT("Table"), [Question] = [_THISROW].[Page 2]))

 

However, this formula does not work.

Furthermore, is there a way to retrieve the column name, not having to hard code it, something like CONTEXT("Column")?

Any suggestions would be highly appreciated!

(As well as general tips and tricks on how to avoid repeating tasks)

 

Solved Solved
0 12 493
1 ACCEPTED SOLUTION

So, for the record, there is no way to retrieve the column name automatically/ without having to hard-code it, (yet). But AppSheet support informed me that a feature request has been submitted.

As for the formula, a little workaround was needed to check for the correct table. Creating a virtual column, which bears the CONTEXT("Table").

Ksenia1_0-1695224460677.png

And then, I check for the virtual column instead. In addition to writing the column name of my Page_Header in quotation. And that worked:

ANY(SELECT(Inspection_Question[Tab], AND([Designation Type] = [Virtual Column], [Question] = "Page 2"))
)

Thanks @jaichith for your support!

View solution in original post

12 REPLIES 12

Expression might be wrong

 

Context("table") is it necessary?

The plan is to maintain several tables in that sheet, so I need to check for the correct table, yes.

Try by removing it. Update please

Shortened the formula to

SELECT(Inspection_Question[Tab], [Question] = [Page 2])

No change, it still shows the default Page 2 instead of "Seite 2"

Ksenia1_0-1695216710663.png

 

Any(SELECT(Inspection_Question[Tab], [Question] = [Page 2]))

Select () will return list of values. It should be wrapped with Any () to get single value. 

Even you can use Lookup () also

Lookup ("Page 2", Inspection_Question, Questions, tab) 

That's true. Unfortunatelly, adding Any() did not help:

ANY(SELECT(Inspection_Question[Tab], [Question] = [Page 2]))

Nor the Lookup():

Lookup ([Page 2], "Inspection_Question", "Question", "Tab")

It still shows the default

Please share the table screen shot where you are applying the expression.

I hope I got your request correct.

So, this ist my questionnaire table

Ksenia1_0-1695218373091.png

My Page 2 Column

Ksenia1_1-1695218440676.png

 

 

It did the trick with putting my column into quotations instead of square brakets.

Lookup ("Page 2", "Inspection_Question", "Question", "Tab")

Happy this works, though, it doesn't solve much of my issue with going through each column and changing the column name there. There is no way to retrieve the column name without hard coding it? And it is not possible to check for the correct table name as well?

So, for the record, there is no way to retrieve the column name automatically/ without having to hard-code it, (yet). But AppSheet support informed me that a feature request has been submitted.

As for the formula, a little workaround was needed to check for the correct table. Creating a virtual column, which bears the CONTEXT("Table").

Ksenia1_0-1695224460677.png

And then, I check for the virtual column instead. In addition to writing the column name of my Page_Header in quotation. And that worked:

ANY(SELECT(Inspection_Question[Tab], AND([Designation Type] = [Virtual Column], [Question] = "Page 2"))
)

Thanks @jaichith for your support!

Welcome

Top Labels in this Space