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

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

Recommended Posts

Posted

Am I wrong or Show custom dialog doesn’t work as its supposed (as said in help file).

 

Notes

If values entered into input fields don’t match the field type, a validation error message displays. The user must resolve validation errors before the dialog box can be closed. See Defining field validation for more information.

 

I have a numeric field. Numeric only validation. Message.

 

Working in the layout, a message appears if other value than number is placed into the field. Perfect.

 

BUT,

I’m trying to avoid the user to enter text into the field while running a script.

 

I have tried to make a loop that works with an already set range of numbers. But if letters are placed I can’t do anything.

 

 

As said in the FileMaker help file when talking about show custom dialog script step, an error message should be displayed, but I can’t see it, lol.

 

Any advice about what should I do?

NumericOnly.zip

Posted

As simple as that.

I was thinking about it, but I was afraid of this could block my script in some way.

I apologise, maybe I should have tried it before starting a new topic.

Thanks for your help No_access.

Posted

If you want to perform pre-processing on an input value(s), better use a utility field for the entered value, then decide how to proceed. This way you can also have your default message for validation errors in any context, and a special error message from within the script.

NumericOnly_eos_mod.fmp12.zip

Posted

As always nice unspected (for newbies like me) point of view eos.

 

Thanks for your advice.

 

I think there are two errors in your script. I am not complaining, very important. :jester:

 

1. If you get into the loop, numericonly field doesn't get populated.

2. The exit loop if doesn't work properly.

 

I think I have easyly solved it. Unless you have another "magical" way of solving it, as always.

 

What do you think?

 

 

I have a question:

 

I have tried negative numbers, OK, decimals (1.2), OK, but in the Hispanic world, decimals are separated by comma (,).

If a number separeted by comma is set it accepts it.

 

Should validate by calc be used, with round function for example?

 

 

Thank you.

NumericOnly_eos_modV2.zip

Posted

You're right; I didn't put the calculation of $valueIsOK into the loop. Here's a (hopefully) improved version that just uses one check on the correctness of the entered value (incl. integer-ness)*, and uses variables for the dialog texts.

 

* If Int ( value ) = value, it's an integer.

NumericOnly_eos_modv3.fmp12.zip

Posted

Thanks for the help eos.

 

As always you give it a twist that takes me a few days to digest :jester:

 

My last twist:

 

Is it possible to skip already chossen numbers from $valueIsOk so they can't be choosed again.

 

I have add a variable that collects already selected numbers and tried to add it to the let function as [and myEntry "not equal" $colector] but doesn't work that way.

Posted

I have add a variable that collects already selected numbers and tried to add it to the let function as [and myEntry "not equal" $colector] but doesn't work that way.

 

Your logic is correct, but you need to consider that each number is collected via a script, and that $collect is a local variable, whose existence ends with that script …which means you need a more persistent (as in: survives the end of a script run) storage method for your collection – either a field, or a global variable, like $$collect. Also, if all this happens on a per-user/event basis, you need to decide when to re-initialize your collection container.

 

Do not use "equal", because your $$collect can be a list, not just a single value; the best way (in FileMaker) to check on the presence of a value in a list is FilterValues ().

Posted

Thank you eos, I have been working on the way you told me.

 

I have added to the scritp other of your advices (from other post) to filter the numbers already choosen, but I don’t know how implement it to the let calculation.

 

I think it can work adding it to $valueIsOK variable, but I still can’t manage those calculations.

NumericOnly_eos_modv3_B.zip

Posted

In the script, the calculation of the variable $valueIsOK acts simply as the central point for the check logic; there are a number of tests (is a number, is an integer, is in range ), all of which the currently entered number has to pass. If you define an additional check, you need to add it to the "checklist" (so to speak).

 

So add

and
Isempty ( FilterValues ( $$collect ; myEntry ) )

 

btw, since you have FM Advance, use the Data Viewer; it's a great playground to test expressions, try out functions, and get familiar with writing calculations.

Posted

 

and
Isempty ( FilterValues ( $$collect ; myEntry ) )

Easy. Works great.

 

What I have found is that $valueIsOK accepts any integer starting with any of the range numbers.

 

The range was 0 to 4, and accepts

 

11

111

2222

333

4444

 

I thought it was because gScratch was a text field so I changed it to a number field. It works but then accepts text. :shocked:

 

 

btw, since you have FM Advance, use the Data Viewer; it's a great playground to test expressions, try out functions, and get familiar with writing calculations.

 

I user data viewer and script debugger very much. The thing is that you have to know how to do the calculations, and I'm just a person of letters :jester:

Posted

11

111

2222

333

4444

I thought it was because gScratch was a text field so I changed it to a number field. It works but then accepts text. 

 

There is some typecasting going on in the checks; if you change the type, you don't know (though you have seen) what side effects that can have.

 

Make sure the field is type Text, then change ( myEntry ≥ 0 and myEntry < 5 ) to ( GetAsNumber ( myEntry ) ≥ 0 and GetAsNumber ( myEntry ) < 5 ).

 

and I'm just a person of letters 

 

So was I, but if you want to code, you have to get used to a modicum of numbers.

 

Good luck with your solution!

This topic is 4083 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.