Using the dict name coming from a string variable

Discussions about editing and cleaning data
Post Reply
AriSilva
Posts: 633
Joined: July 22nd, 2016, 3:55 pm

Using the dict name coming from a string variable

Post 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
Best
Ari
Gregory Martin
Posts: 1977
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Using the dict name coming from a string variable

Post 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;
htuser
Posts: 692
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: Using the dict name coming from a string variable

Post by htuser »

Ah, dictionary symbols whose names are unknown until runtime. That was requested a long time ago and is one of the rare features I did not implemented in the fork.
The most recent features I implemented were:
a) Independent-level dictionaries, after extending dictionary support beyond three levels, up to 8 levels per dictionary. A level can be marked as independent, which makes each of its nodes a case of its own, with its own key and no parent node. The option lets two kinds of case share one dictionary and one data file, in an external dictionary or in the main dictionary of a batch or data entry application.
b) Wi-Fi Direct (Wi-Fi P2P) for direct data sharing between devices. The legacy Bluetooth is slow and very limited...in range...
Best,
You do not have the required permissions to view the files attached to this post.
G.VOLNY, a CSProuser from Haiti, since 2004
Post Reply