Autofill column descriptions from table I ha...

(Pim Sauter) #1

Autofill column descriptions from table

I have a table questionnaire with column names: first_name | last_name | favourite_animal | …

and another table questions with column names: question_id | question_body

with records like first_name | “What is your first name?”

On the form I would like the description to fill with the question body. For this I wanted to refer to the column name, and the do a LOOKUP, but I can’t figure out how to refer to the column name (or solve the issue in another way).

Any ideas?

(Aleksi Alkio) #2

LOOKUP(“first_name”,questions,question_id,question_body)

(Pim Sauter) #3

Yes, but now I would like this “first_name” to be derived from the column name

(Aleksi Alkio) #4

Unfortunately we can’t read the “fixed” column name.

(Dinh Nguyen Nguyen) #5

@Pim_Sauter Could you explain why you need to separate the questions and the questionnaire into 2 separate tables. It seems the need to dynamically identify columns based on column names stems from this design choice.

If you want the displayed question to be different from the column name, you can just type the question into the Column Description field of the column. In form views, the column description will be displayed instead of the column name.

(Pim Sauter) #6

@Harry I already have a list of ~150 questions in multiple languages; ready in a table, and wanted to avoid copying them one by one into the description field, if possible. I figured I could reference them by the column name, but unfortunately I cannot then and will have to go for this approach.

(Pim Sauter) #7

Also, I am working with a database, so I cannot have the questions as column names, as they contain spaces

(Dinh Nguyen Nguyen) #8

@Pim_Sauter The column description does accept expression, so you can use the expression that @Aleksi_Alkio suggested. However, since it’s not possible to dynamically extract the column name at the moment, you will need to “hard-code” the column name into the expression.