0
Compare two fields
Hi!
I have a 'TableHere' table with 10 records and two text fields filled in:
Text1
Text2
I want to create a button that compares the two fields and tells me in which records the fields are not identical.
This is what I created, but it doesn’t work.
let afsel := (select 'TableHere');
for loop1 in afsel do
let afid := loop1.ID;
if loop1.Testo1 != loop1.'Testo2' then
alert("Campi diversi nel record " + afid)
else
alert("Campi uguali")
end
end
Copy
Where am I wrong?
Thank you
6 replies
-
I think your code is right, but the alert message does not wait for the user to press ok. If another message comes, it replaces the previous one. So you can only see the last message displayed by the loop.
Use the dialog to see all messages one by one: https://docs.ninox.com/en/script/function-overview/functions/dialog
-
It's just because you declared the variable "afver" twice with the "let" statement.
Try this code:
let afsel := (select 'Copia Incolla Cancella Paragona'); let afver := 0; for loop1 in afsel do let afid := loop1.ID; if loop1.Testo1 != loop1.Testo2 then afver := 1; end end; if afver > 0 then dialog("ATTENTION", "There are different fields", ["OK"]) end
Content aside
- 2 yrs agoLast active
- 6Replies
- 138Views
-
2
Following