Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Complex validation + enable fields


phalkone

Recommended Posts

I'm a newbie to FM so bear with me. I want to do a complex validation and if the validation is successful I want to show a field (otherwise I want the field to be hidden).

My files have a file record number which has to be entered in following format:

example: A070619VL00O

- First letter is an A or a B

- The next 6 characters make up a date in this format year/month/day

- The 8th and 9th characters are any two letters

- The 10th and 11th characters are always 00

- The last character is any letter

 

If this validation is successful when the user leaves the field I want FM to enable a hidden field and go to this field. If validation fales I want him to skip the hidden field and go to the field after that one.

 

All help would be greatly appreciated,

Link to comment
Share on other sites

My files have a file record number which has to be entered in following format

 

I'm sorry, what you want can probably be achieved but I can't help being allergic to eyewatering codes like this. Validation of the format wil give you an OK on the format, but it will not give you certainty that the right number has been entered!

 

So what is the procedure involved, what files are you talking about? hardcopy ones or digital ones?

So who decides what the number should be? where does it come from? Why don't you let filemaker handle these numbers instead of burdening your users with them?

 

kjoe

Link to comment
Share on other sites

a) Use this trick in combo with the formula below for the calculated side of the selfjoin relationship that you'll see described at the above link:

 

b) The formula for RecID_IfConditionsAreMet would be:

 

Case(

(Left(Table::Fieldx; 1)= "A" or Left(Table::Fieldx; 1)= "B") and

IsValid(GetAsDate(Middle(Table::Fieldx; 4; 2)&"/"&Middle(Table::Fieldx; 6; 2)&"/20"&Middle(Table::Fieldx; 2; 2))) and

PatternCount("ABCDEFGHIJKLMNOPQRSTUVWXYZ"; Middle(Table::Fieldx; 8; 1))+PatternCount("ABCDEFGHIJKLMNOPQRSTUVWXYZ"; Middle(Table::Fieldx; 9; 1))=2 and

Middle(Table::Fieldx; 10; 2)="00" and

PatternCount("ABCDEFGHIJKLMNOPQRSTUVWXYZ"; Middle(Table::Fieldx; 12; 1))=1 and

Length(Table::Fieldx)=12;

Get(RecordID)

)

 

 

 

 

There may be more elegant ways of doing some of that (I probably should have used Let ["ABCDEFGHIJKLMNOPQRSTUVWXYZ" = $alpha] to avoid typing out the same string more than once, althought it might be easier to see what I'm doing this way, and probably less klunky ways of abstracting some of the other values if I thought about it), but that oughta work unless I made a typo or a miscount of field position.

Link to comment
Share on other sites

Maybe I cheered a bit to fast. My fields are inserted into a tabsheet and sometimes I have to click besides the tabsheet for FM to notice that the value is valid and display the hidden field. (Sometimes it does work properly). I really don't see what the problem is. Does this have anything to do with indexing?

Link to comment
Share on other sites

Well, the record has to be committed after changing the relevant field values. If you're tabbing from field to field (or manually clicking from field to field) and never hitting Enter, the record changes haven't been committed yet, so the calc field that depends on them doesn't get evaluated yet, ergo no valid portal yet.

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

Terms of Use