Dictionary from a loaded variable?

I would like to create a dictionary from a variable, wherein I have loaded a text file. The text file contains names and shortcuts of German soccer league clubs in exactly the way I would list the entries as parameters for the initializedictionary statement. (The statement is working perfectly when I follow it with the long list of pairs of quoted text.)

Is there a way to pass the contents of my text file as a variable to the initializedictionary (or a similar) statement? When I try that, I get an error warning “InitializeDictionary statement needs at least three parameter”.

I think you can do that with the help of an execute( function

Let myVariable = fileload("Abk.txt")
Let myDictionary = execute("FunctionValue initializedictionary("+myVariable+")")
1 Like

That’s really clever Dave. I never thought of using functionvalue in the execute( function that way.

That got me to thinking whether I could build a function that does that out of the box, and after pondering that for a moment I realized there already was one. So here’s another way to skin this cat:

let myVariable = fileload("Abk.txt")
let myDictionary = formulavalue("initializedictionary("+myVariable+")")

Jim’s “way to skin this cat” works perfectly. Now it is a lot easier to do my preparations for new seasons in five league databases. Thank you, Dave and Jim!