Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3867 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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

Posted

Why don’t use the tools that you paid for. i.e. Script Debugger and Data Viewer?

  • Like 1
Posted
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.

  • 5 months later...
Posted

Nice, thanks again guys. I'm just getting my head around the logic.

 

Appreciate it.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.