Using triggers for yes/no field
I have tried using the visual part of the Ninox formula and various forms of this text in the script writing, all to no avail.
if Status = ("Closed" or "Expired") and 'Campaign Premium' > 0 then
Winner = "True"
else
Winner = "null"
end
I've tried that code in the "Winner" field's Display field only if (which hides the field at all times if I leave it there), and I've tried it in the After Update which allows display of the field, but under all conditions and does not ever set the checkbox to Yes.
Any help is welcomed!! Thank you.
Here's the pertinent database layout.
- I have a field named "Status" that has only 5 options, 2 of which are Closed and Expired
- I have a currency field named "Campaign Premium"
- I have a yes/no field named “Winner”
- I want the Winner field to ONLY display IF the Status field is either Closed or Expired.
- When displayed, I want it set to “Yes” if the Campaign Premium is greater than Zero
18 replies
-
Try:
if Status = "Closed" or Status = "Expired"
Ninox doesn't have a way, that I know of, to combine search terms.
-
Hi Rick
You need to be checking for an update in the Status and Campaign Premium fields but you have your code in Winner. Place the same code in these two fields and take it away from Winner and all should be good.
Regards John
-
You mght also need to change Status = "Closed" to text(status) = "Closed" or better still status = 1 (the option number of status for Closed). And do the same for Expired.
Ninox is encouraging us away from hard code in our scripts by working this way, It allows for a change in the name of option 1 without breaking the script
-
Rick - New to Ninox! Then welcome to user forum. You will find lots of help and support from some very dedicated users.
Johns right, Better to go with the index number of the choice. You will see the index numbers in edit mode on the choice itself.
Once you are fully immersed in Ninox you will love the way it works. Not perfect, but very satisfying to use.
-
Thanks Mel and John and Fred.
I was able to get the get my winner field to show only when I want it by adding this code to the display only if section:Status = 2 or Status = 4
Appreciate the help.
I tried adding the other code to the Campaign Premium field, but get the following error:
-
said:
HOWEVER, why doesn't Ninox update ALL records that apply to the code? It only flips my Winner switch when I'm in a particular record. So, I'm ok for all new records, but none of my old records unless I go back and change something in each one. Solutions?The code is not setup to update a group of records. You didn't say you wanted that so that is not what was written. Ninox is doing exactly what is written. No more. No less.
said:
I wouldn't even need this switch if Ninox had a query language, but creating reports and querys is beyond me.Currently in any DB you will have to learn some coding language to do querys. Natural language coding a bit further off in the future.
If you are willing to learn, we are here to guide.
-
Really appreciate it Fred. I'm definitely willing to learn. My brain is still stuck in the 90s using Microsoft Access...which I understood very well. Ninox has been great and I converted a system I was using Google Sheets for to Ninox in the spring and have been very happy. I just KNOW that with some knowledge and skill, I could get more data OUT of the database in the form of charts and reports if I can master it.
Thanks again!! -
Rick
I too came from the MS Access and Dataease era and I promise that you will be able to do 99% of the stuff you can do with these. Hang in there it definitely will get better.
Just a couple of tips Unlike access/dataease you do specify a key field relationship.- You specify a table relationship once do all fields are linked. Keep in mind that you are not designing a table structure and then the form afterwards, it's all wrapped into a one step process.
There are some excellent videos on utube etc, look for Nioxus or here
https://www.youtube.com/@NinoxLearning/videosIf you have a copy of the MS Access Bible (you know the one - that huge tome with like 900+ pages). Then either throw it away or use it as a door stop - you won't need it anymore cos Ninox is totally different.
So stuff like VLookup is consigned to the bin! Mind you, I still love Excel with VBA
Content aside
- Status Answered
- 11 mths agoLast active
- 18Replies
- 197Views
-
4
Following