November 19, 201312 yr 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
November 19, 201312 yr You could modify your existing step as: Length ($UI)<>10 OR yourTable::yourDate > Get ( CurrentDate ) - 7
November 19, 201312 yr Author 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
November 19, 201312 yr Why don’t use the tools that you paid for. i.e. Script Debugger and Data Viewer?
November 19, 201312 yr 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.
April 22, 201411 yr Author Nice, thanks again guys. I'm just getting my head around the logic. Appreciate it.
Create an account or sign in to comment