0

JSON in dynamic fields

So I've been testing out the new JSON in dynamic fields and ran into a few issues. I emailed Ninox and got this response:

Thank you for reaching out and for sharing the details about your use of JSON in dynamic choice fields.

To address your inquiry:

  1. Ninox provides the option to use JSON and HTML for advanced customizations, including dynamic choice fields.

     

  2. However, please note that this functionality is offered without official support. Implementing and managing it will be at your own responsibility.

If you have any additional questions, feel free to ask!

Huh? Wasn't this a major feature in 3.14?

Here was my original email:

Playing around with JSON in dynamic choice fields.

 

1) If I build it using something like:

 

for i from 1 to 13 do 

{

id: i,

caption: text(date(2024, i, 1))

}

end

 

It works fine in choice and multichoice. I can do number(s) and get the selected choices.

 

text() does not return anything. Is that normal? Is there anyway to get the caption data?

 

2) If I build the JSON using data from another table or two, and use the recID. Ninox builds the dynamic field but when I try using number(s) I get nothing returned. 

 

What are the current limiations with JSON data in dynamic fields?

 

Thanks,

What have others encountered with the new dynamic field function?

3 replies

null
    • szormpas
    • 9 hrs ago
    • Reported - view

     Hi, I've just started using the new toy!

    It looks like you can get the caption by referring to the field name without the text().

    raw('Choice (dynamic)') gives the id as a string.

    number('Choice (dynamic)') gives the id as a number.

    • szormpas
    • 9 hrs ago
    • Reported - view

     

    I might be wrong, but as far as I understand the dynamic choice field always converts the id to a string.

    The number() function can't translate something like "A1" to a number, but it can do that with an id like "1".

    • Fred
    • 8 hrs ago
    • Reported - view
     said:
    It looks like you can get the caption by referring to the field name without the text().

    Well what do you know.

    But if you do a debugValueInfo() on a dC or dMC then you get something like:

    dchoice("C7")
    
    or
    
    dmulti("f1")
    

    not very helpful is you need to use the data. It doesn't really return the caption value in a useful form.

    raw() only seems to work for choice fields. multichoice doesn't return an array of choices. So you can modify the Id to:

    for rec in getTableA do
        {
            id: number(rec.Id),
            caption: sum(rec.Score)
        }
    end
    

    Then you can get something useful.

Content aside

  • 8 hrs agoLast active
  • 3Replies
  • 16Views
  • 2 Following