Harry Posted November 19, 2013 Posted November 19, 2013 Hello Board! I've nearly completed the overhaul of my FM app thanks to your help. It's looking great. One step that i'm stuck on is a validation script. I have the user scan a barcode into a Custom Dialog Box. FM sets this as $UI and then runs a IF [Length ($UI)<>10} Exit Script Else.... to make sure it's only 10 digits long. I also want to reject (exit script) it if that $UI barcode has been scanned in the last 7 days. I'm sure this is possible. I would have to run a search for that $ in the table, then do something like 'GetTodaysDate' and then do some sort of match against 'TodaysDate' - 7Days??? I have no idea how this would work. Any help you can give me would be greatly appreciated as always. H
LaRetta Posted November 19, 2013 Posted November 19, 2013 You could modify your existing step as: Length ($UI)<>10 OR yourTable::yourDate > Get ( CurrentDate ) - 7
Harry Posted November 19, 2013 Author Posted November 19, 2013 Hi! Thanks! My <> doesn't work for a start... Set Field [uI::UI Number; $UI] If [Length(UI::UI Number)<>10] Delete Record/Request [no dialog] Exit Script [] End If Can you see what's wrong with it? It's long winded, i suppose. Can i just ask if the variable is <>10, rather than setting a field as the Var and then questioning that field contents? But thanks for writing out the date issue. I could not figure it out. I can just use '7' rather than '7' days? How can i get it to look at 7 seconds or 7 weeks or 7 months? Thank you again! H
Lee Smith Posted November 19, 2013 Posted November 19, 2013 Why don’t use the tools that you paid for. i.e. Script Debugger and Data Viewer? 1
comment Posted November 19, 2013 Posted November 19, 2013 I have the user scan a barcode into a Custom Dialog Box. FM sets this as $UI Since you scan into a field first, you can start with: If [ Length ( ScanInputField ) ≠ 10 ] # reject Else # accept and continue ... End If Ideally, the ScanInputField would be a global field, so you would not need to delete the record upon reject. Instead, create a new record only on accept. I would have to run a search for that $ in the table, then do something like 'GetTodaysDate' and then do some sort of match against 'TodaysDate' - 7Days??? Well, you could define a relationship showing any records with a matching barcode and creation date in the last 7 days. But performing a find would work too. You can do it all in one by finding records where the barcode = gScanInputField AND creation date ≥ Get ( Currentdate ) + 7.
Harry Posted April 22, 2014 Author Posted April 22, 2014 Nice, thanks again guys. I'm just getting my head around the logic. Appreciate it.
Recommended Posts
This topic is 3867 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now