Page 1 of 1

Using the dict name coming from a string variable

Posted: October 30th, 2026, 4:32 pm
by AriSilva
Hi folks,
Is there a way to write something like:
string dictName = "SD_PROF_10_ENTREVISTA_DICT";
setfile(dictName, "file.csdb");

I need to set the dictionary in a function depending on a parameter.
Best
Ari

Re: Using the dict name coming from a string variable

Posted: November 2nd, 2026, 10:08 am
by Gregory Martin
There are a lot of times it would be nice to use a string variable to specify a dynamic dictionary / variable / etc., but unfortunately that's only supported in a few places. Your best bet would be to create a dummy function like:
function SetDictionaryFile(string dictionaryName, string filePath)
    when dictionaryName;
        "DICT1" -> setfile(DICT1, filePath);
        "DICT2" -> setfile(DICT2, filePath);
        "DICT3" -> setfile(DICT3, filePath);
    endwhen;
end;