Issue with trigger conditions in 'Liste' Field: Multiple Text conditions not triggering as expected
I have an issue with a trigger in the 'Liste' field. I would like to create multiple triggers in the 'Liste' field that check if certain text is contained within it. For example, if the text 'Americana H' is contained, then it should select the first record from the 'Zertifikate' dynamic multiple-choice field list. Then, if the text 'Boden lackiert' is also contained, it should also select the second one, and so on. My problem is that if I input two or more triggers, it always checks only one condition. I am attaching the screenshot and the table "Allegati" to which the 'Zertifikate' dynamic multiple-choice field refers.
if contains(Liste, "Americana H") then
Zertifikate := [1]
end;
if contains(Liste, "Boden lackiert") then
Zertifikate := [2]
and so on
13 replies
-
Hi. Unfortunately, it's not quite as simple as that. Have a look at this post
https://forum.ninox.com/t/83hrts2#y4hrsgn
Regards John
-
What kind of field is Liste?
-
Another question is what are you trying to accomplish?
Is a user supposed to type in Liste? If the user is supposed to type then it seems like an extra step when they can just select the correct records.
Or how is the text generated in Liste? If so then maybe you need to go back a step or two in your process to figure out if you can update this dynamic multichoice (dMC) an another step.
-
You can try the following in a button to test it out:
let getAllegatiRec := (select Allegati where Aktiv = 1); let makeArray := split(Liste, ", "); let getSelectedAllegatiRecs := for loop1 in makeArray do getAllegatiRec[Descrizione = loop1] end; Zertifikate := getSelectedAllegatiRecs
I've tried to fill in your details as best I could so there could still be errors.
Line 1, I create a variable that gets the same records as the dMC field.
Line 2, I create an array of the test field Liste. This will only work as long as the names do not have a "," in their names.
Lines 3-5, another variable is created that stores an array of records from the variable in Line 1 that matches each item of the newly created array of the text fields in Liste. I noticed that the text in Liste do not match perfectly with the Descrizione field. This code is setup for exact match. You can try "like" instead of equals. Or we can try other options if like doesn't work.
Line 6, lucky for us Ninox now allows us to set multi choice fields with arrays, so now that we have an array of records from Allegati that we want we can set the Zertifikate dMC field to our new array.
Once everything works, then you can transfer the code into the Trigger after update of Zertifikate.
Try to get comfortable with making and manipulating arrays as that will take you far in writing scripts that can manage your database.
-
said:
It's a simple text field that contains keywords. If any of these words match with a word in the text field 'Liste', it has to flag the corresponding field in the dMC 'Zertifikate'. It works but only for the first matchI switched to contains() as well and I have no issues.
Content aside
- Status Answered
- 6 mths agoLast active
- 13Replies
- 85Views
-
3
Following