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

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

Recommended Posts

Posted

Happy Monday folks!

Rather than using the field definition, I would like to validate a field using a script because some users will validate it and some will not. The validation should be from a value list created by a field in a related file. I understand the IF business etc. I am just missing the calculation for the IF.

Thank you so much in advance, Kay

Posted

Happy back :-)

you can use the if-statement in a script, but there is no way to call the script after leaving a field (just use a plug-in or define an idle-script).

Willi

Posted

Use the ValueListItems(dbName, valueListName) function in a calculation - it returns the text of a value list. Then use the Positiion() function to find if some text (i.e. a value list item) is in that.

Posted

If I understand "value list created by a field in a related file," you are wanting to see if what is input into Field A matches at least one record in Field B in a related file. (The fact that Field B may be being used to create a value list doesn't necessarily matter for the purposes of the following calc.) Here's how:

1. Create a relationship, Field A::Field B

2. The calc for your If would be:

If [ IsEmpty(Relationship::Field : ]

You could also use -- not IsEmpty.

Posted

Hi kattatonic smile.gif

I would like to validate a field using a script because some users will validate it and some will not.

Well, if you attach through your field definition, a Validation by Member of Value List, and select 'Strict do not allow user override' and enter a message if you wish, your Users MUST insert an item from your related value list or they can't continue. Wouldn't that be much simpler or am I missing something here?

LaRetta

Posted

Thanks guys! I will be more specific. Users fill in a Timesheet in one database. Some of them must enter a valid Division and Branch. The Divisions and Branches are listed in another file. Division A might have Branches B, C and D, and Division W might have Branches X, Y and Z. The ones who must enter a Division must choose a valid Division and one of ITS valid Branches. The relationship and value lists are working and I have formatted pop-up lists properly in the layout. They will click a Submit button when they are done and I wanted this script to be one of things that runs when they click Submit. So this part of the script should be:

IF (certain conditions apply - which is working)

IF (Division is not valid) ?

Show Message

Halt script

IF (Branch is not valid) ?

Show Message

Halt script

END IF

END IF

END IF

What do you think? Thanks, Kay

Posted

Hi Kay smile.gif

It is much simpler to use a relationship to filter your value list than using a script. For instance, if the User (in Timesheet) selects Division A, you can filter the Branch Value List so it only shows valid Branch entries for Division A. The same when the User selects Division W. I've attached a simple demo to show how this value list filter works. If you need further assistance, let us know.

You mentioned that *some* users need to enter Division and Branch. If there are additional validation requirements, you can fine-tune your filter by modifying the stored calculation in your other dB (which I called Company).

LaRetta

test.zip

Posted

You are a darling! I have done almost exactly like you have done in the demo. The problem is that I want to force some of them to stick to the validation and they do not fill in some of the criteria determining if they should until near the end of the forms. Since they enter Division and Branch in beforehand, the validation gives them an error message. The client wants the ability for them to fill in the forms in exactly the order in which they appear and check for validation afterward. :-(

Posted

Hi Kay!

You don't need a validation if the Branch is filtered, based upon Division. They will have no choice but to choose a valid branch (based upon the proper Division). Otherwise, a script would certainly work also. I'll take a look at your current script and see if I can help you with it.

LaRetta

Posted

Hi Kay,

What are your validation requirements? How do you determine which User is required to fill in Division and Branch? Or are there other validation requirements? Knowing that, you can change your stored calculation in Company to change your validation requirements. Or you can attach a script directly to your Branch field, or use a button to run a validation script at a later point. If you could give us a bit more information, we could step you through the options. What version of FM are you using?

LaRetta

Posted

Hi LaRetta - I so appreciate your time,

I have a script which determines accurately if the fields should be empty and sends them back to the field if one is empty and shouldn't be.

The reason I want it to be strict validation is that when the pop-up list drops (on original entry or when we run the script), a user can click delete or backspace and type in something invalid. For example, I have had users select "Administration" and then backspace unintentionally; then instead of clicking to drop the list again, just type in "Admin", which is wrong.

The only thing I am missing now is a script step that asks: is the field entry valid?

I know this is picky - but so is the client ;-)

Regards, Kay

Posted

The Divisions and Branches are listed in another file

Use the IsValid(your relationship) or not IsValid(your relationhip) functions to validate if the "password" is valid.

Posted

Hi Kay,

I believe you will need to validate Branch against the 'filtered' Value List relationship established as in my demo file. I believe Eric is right in using Position. But I don't understand how to validate one entry in Branch against a filtered Value List using ValueListItems[]. Sorry.

LaRetta

Posted

Hi La Retta, Hi Kay,

I slightly modified your test file with the IsValid relationship + one very simple way to force the user to enter the appropriate value. Don't know where this can lead us.

Edited : Sorry Tom, didn't correctly read your post. IsEmpty or IsValid would produce same results. I don't understand why this wouldn't work ?

Posted

YAY!! I needed all your tricks to make it work.

<< Applause. Applause.>>

LaRetta

dilucaugo68

Eric

Willi

Tom

<< The crowd roars. >>

Thank you so much! Kay

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