Jump to content

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

Recommended Posts

Posted

Hi to all the FMers,

Very nice job on the new forum look, BTW.

The question is: how do I script something like:

case(field1="on@", "1",

field1="tw@", "2",

field1="thre@", "3",

field1="f*", "4", "no number")

In other words, instead of hardcoding the litterals, can I use the same wild card symbols available in Find Mode for searching? This would alliviate considering all the litteral possibilities, and hardcoding them in a calculated field.

Thanks

Posted

Well, the way you have it you are almost entering all the information anyway as it will only return the one result

But, if you want to find that text within a field and return a specific number then you could try

Case(

PatternCount( field1, "on"),1,

PatternCount( field1, "tw"),2,

PatternCount( field1, "thre"),3,

PatternCount( field1, "f"),4,

"")

Then if it falls anyware in that field it will return the number.

Is this what you want?

Posted

I'm not sure of you question but if you want wild cards in you scripted searchs you'd do somthing like this:

Enter Find Mode[]

SetField [ SearchField, "Otherfield & "*"]

Perform Find

Posted

Just remember, if you are using Find mode in a script to enter the Filemaker find symbols, its best to use the InsertCalculatedResult. SetField relies on the data being the same format as the destination field - so for finding dates which fall within a range, for example, you should use this script:

Enter Find Mode[]

InsertCalculatedResult[Date, DateToText(Date1) & "..." & DateToText(Date2)]

Perform Find[]

A SetField step containing "DateToText(Date1) & "..." & DateToText(Date2)" would not work in this case because the result is not a date format.

Posted

I guess my question was: Can I use wild cards in the calculated fields rather than in a script, and from your answer I understand that I can not.

I could write that script, and than make it run on opening the file, but that would be annoying to those that don't need to see these code fields.

Thanks for your help.

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