![]() Let choiceRecordIDs := for i in splitArray do Let splitArray := for i in splitArray do trim(i) end Let splitArray := split(stringifiedArray, ",") "// Accepts a stringified array of iso2 country codes and generates a hex string for passing into a dynamic multi choice field" įunction generateHexStringCountries(stringifiedArray : text) do ![]() I'm sure someone is capable of producing something neater. If you choose to use this code, note you will have to tweak TABLE NAMES and FIELD NAMES, which I've had to hard code, as Ninox doesn't allow these to be passed into functions themselves. I was able to use this function to programmatically convert those to the correct DYNAMIC multiple choices, which link to a table called Countries, where each record has an iso2 country code and the corresponding country name. I have 1000+ records of companies with a Text Field that contains iso2 country codes for where offices are based, e.g. it's a bit "hack-y" so I can't say how robust it will be but it's proven excellent for my use case. This is a script I've got working for me at the moment. Will Ninox make it possible to programmatically assign Multi Choice Dynamic Field options via NX Scripts? Please? Then, I began declaring the Multi Choice Dynamic Field a random STRING of numbers I plonked into my keyboard and was astonished that it would randomly select a number from the list. Strangely, just to experiment, I used the console to read the output of a Multi Choice Dynamic Field that had a couple of countries selected and the response was a long STRING of numbers. I played around and found there is no way of declaring countries, either by running a for loop and iterating over a set of country codes, or by passing an array. However, I run into problems when I try the same for Multi Choice Dynamic fields. Let allChineseCompanies := select Companies ĬuntryDynamicSingleChoice := number(chinaID) Let chinaID := first(select Countries).id I can then declare a Single Choice Dynamic field in another table with that ID, e.g. If I have a table with records: then I can write a script that can find the ID of the record based on either Code or Country. You can programmatically assign a value based on the ID of the record in the table it links to. Anyway, the Single Choice Dynamic Field is straightforward enough. It has its niggles (why does it have to link to another table? Why not a global variable that returns a list, for instance?). Hi - the latest Ninox update has lots of interesting new features to play with, great to see it launch.ĭynamic lists is something we've all been clamouring for.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |