Hi, I am trying to achieve what I imagine to be, a very simple process but keep hitting a brick wall.
I have a button set up on my form to clear certain fields when pressed (2 date and 2 time fields)
The button works fine but I want to add a dialog with yes/no options, this also works but selecting yes or no gives me the same result.
I have tried if/then and switch but no joy. I have added a seperate yes/no switch which the button can control but I get the same result.
I'm assuming that this is a simple one and I have just missed part of the formula or syntax is incorrect.
This is the current (simple) version which is only addressing one date field:
dialog("", "Do you wan't to clear all dates?", ["Yes", "No"]);
if "yes" then 'Ship Date' := null end
The yes button works correctly but clicking no also clears the field.
Any advice is greatly appreciated
Hi Bill & Antonello, Mnay thnaks for responding.
I had tried that previusly but the result is that clicking yes or no on the dialog has no effect on the field.
All very confusing, I usually find that after "playing" with the formula for a while; Ninox usually returns the correct result.
I wonder if it relates to the behaviour of date fields.
Thanks again for the advice
Hi again Rob,
There's an error in your code snippet, you have "Yes" in the dialog but "yes" in the next line. They need to be the same.
I've checked the following and it does work, just as Antonella's should as well. If you select "No" today's date is returned.
let 'Ship Date' := today();
let ans := dialog("", "Do you wan't to clear all dates?", ["Yes", "No"]);
if ans = "Yes" then 'Ship Date' := null end;
alert("Ship Date " + format('Ship Date', "DD MMM YYYY"))