I would need to attribute the name of $$variable accordingly with:
a) a previous calculation
b) the field content of an other text field (stored)
Many thanks for your help,
I think that you want to dynamically name and create variables.
you can assemble a text string that forms a let function that you pass to evaluate in order to create a variable and assign a value to it.
evaluate ( “Let $" & table::field & "= " & table::field2 & " ; 1)" )
will assign the value of field 2 to a variable named using text in field. If field 2 is of type text, you’d need enclosing quotes such as:
evaluate ( “Let $" & table::field & "= " & Quote ( table::field2) & " ; 1)" )
You can also escape quotes with the backslash such as "\"word\"" becomes "word".
Any text calculation that produces a valid Let function call should work.
Could you give an example of what you're actually trying to accomplish? What is the user experience supposed to be? What do you hope to do with these variables?
this would be an alternative of having too many global fields to be used as labels for fields in layouts.
I have a table with many terms (labels) translated into 3 languages, basically:
"language" (global, value list with 3 languages)
"label_name" (1 records for each) total of more than 4000 records
"label" (3 repetitions, one for each language)
"calc_label" calculated value which is "$$" & label_name, example:
label_name = "FirstName", calc_label becomes $$FirstName
the $$vabiables for that specific record should be named $$FirstName and its value would be one of the 3 repetitions accordingly with language.
The problem is: how to name $$variables based on calc_label.
Instead of many variables with different names you might take only one variable with repetitions.
You could use JSON to store this data. You pass the JSON field names as strings; in your case the value of a calculation field. You'd still have to find a way to get the value out of the JSON structure to be used as a merge field on your layout (I'm assuming that's what you're aiming for).
I do not know what I am missing
For my example fields as above, I wrote the following script
Set Variable [ $var ; evaluate ( “Let $" & Labels::label_name & "= " & Quote ( Labels::label) & " ; 1)" )
In Data Viewer $var is ?
It was just simple, correct formula is:
Evaluate ( "Let ( $$" & _Labels::label_name & "= " & Quote ( _Labels::label) & " ; 1)" )
Many Thanks philmodjunk
Yep, whether you need $$ or $ was not something that I could tell from the original post as you might use either depending on whether you need the values to persist after the script exits. The more detailed response from you had not appeared when I started putting together that reply.
Please not that just because you can do this does not mean that you should. You might also evaluate some of the other suggestions here. Not only can you use a repeating variable in stead of naming the variables there's also a "named bucket" method where the name, instead of being the name of a variable, is the name used as an index with the repeating variable.
Sorry, I am new to this
"there's also a "named bucket" method where the name, instead of being the name of a variable, is the name used as an index with the repeating variable"
May you give me an example ?
Using the magnifying glass tool and searching for "named buckets", I found this very similar discussion.
Thank you !
Retrieving data ...