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

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

Recommended Posts

Posted

Hi everybody,

I have a database and want to make a search layout with 3 global fields to search.

- search key name

- search key title

- search key type

They are global fields (text). I made a script to search:

------

Enter find mode []

Set field ["Name of the Plant", "search key name"]

New record/request

Set field ["Tiltle of Paper", "search key title"]

New record/request

Set field ["Process type", "search key type"]

Perform find [replace found set]

But I cannot find exactly name of the plant or title of paper I need when I typed in field "search key name" or in field "search key title". It showed the message "There are no valid criteria in this request. Type a valid request before clcking Find". I click continue and it showed other ones, not the name I wanted. For process type (search key type), it can show right name.

My problem is I cannot search separately for name in 3 fields I want in the same file. Could you help me solve this problem?

Thanks,

Snow

Posted

One thing to do is make sure

"Name of the Plant"

"Tiltle of Paper"

"Process type"

are also text fields.

Does this produce any results when you do a search by hand. That is, manually type in a test case into the above three fields in the same manner in which you've scripted them.

Posted

Snow,

I remeber once that you had an attachement where you couldn't make an If script to work because you entered If (field = "treatment plants"), while you only had field containing "treatment plant" (without the "s").

Please check that you're doing it again.

Else, are your fields using value lists ?

As Paul said, check manually before going into the script process.

r script for "Treatment Plants" cannot work anyway as you script a If Choice = "Treatment Plant", so you forgot the final "s".

Posted

Thanks Paul and Ugo,

"Name of the Plant", "Tiltle of Paper", and "Process type" are also text indexed fields.

Yes, this produced any results when I do a search by hand after appeared the error message as I metioned above. I checked each field before using the script and it only worked with search key type.

I also checked the field name but it didn't have any mistake. I don't use value list. Could you tell me why only one field can do this search?

Thanks again.

Snow

Posted

"But I cannot find exactly name of the plant or title of paper I need when I typed in field "search key name" or in field "search key title". It showed the message "There are no valid criteria in this request. "

For sure, these are global fields...

Try making a manual search on the TEXT fields...

1.Now, I still think either your script is not the one you have written here. From what you've just said, it could be that your script does SetField(global, "text field") instead of SetField("text field", global).

2. Make sure the search global keys are GLOBAL fields

3. Make sure the text you're entering is exactly the one you're processing.

4. Try this test.

Create 3 relationships :

R1--key name::Name of the Plant

R2--key title ::Title of Paper

R3--key type ::Process Type

and 3 calculations to check if there are really any matching keys :

c_checkRel1Valididity= Case(Is Valid(R1::Name of the Plant), "Valid","Not Valid")

c_checkRel2Valididity= Case(Is Valid(R2::Title of Paper), "Valid","Not Valid")

c_checkRel3Valididity= Case(Is Valid(R3::Process Type), "Valid","Not Valid")

Posted

Hi Ugo,

Thanks for your help. It works now after I made 3 relationships. But I still don't know how to make 3 calculation. Could you explain it to me clearly? I made a field c_checkRel1Valididity then I copied Case(Is Valid(R1::Name of the Plant), "Valid","Not Valid")to put it into the box but it appeared the error message [either can operator was omitted, this function cannot be found, or "(" was not expected here]. How can I do that check now? This script worked well already but I like to learn about check calculation smile.gif Could you show me how to do now?

Snow

Posted

1. What did you exactly do that changed your script to finally work ?

2. Copy paste would work if you're using a US Version of FM. Other versions may require another CalcName (French version:Case--->TEST) or replace the commas ( "," or ";").

Finally, could be that the calc would be :

Case(Is Valid(::R1:Name of the Plant), "Valid","Not Valid")...

But better would be to check the define field dialog box for calculation.

What the calc is doing is checking if the relationship is valid. The Is Valid function could have been changed with the Is Empty function with no change to the result, as well as an IF statement instead of a CASE.

Hope this helps.

Posted

Hi Ugo,

It still appeared the eroor message "either can operator was omitted, this function cannot be found, or "(" was not expected here" and it marked the word 'is valid'so maybe something wrong there but I couldn't find out. I tried to space or changed something but it couldn't let me do it at all. As for that script I don't know why it works well that file but when I tried to do with the other one, it didn't work so I am confused a lot although they are same files but different time to make. I used the debug to check and I saw it appeared the name of Plant when performed enter find mode, set field ["name of he Plant", "search key name"] - New record/request. After that it disappeared when peroformed other set fields... then when it performed find [treplace found set], it said no records match this request. I am confused a lot although I checked the script, relationships and field names, types already.

Do you know why I have this problem with another file again?

Snow

Posted

The best way we could help would be that you attach your file here. There are so many options to check and the calc could be different from versions to versions, while it set itself when downloading from system to system.

About your script, is it that the text fields you're targetting are related fields ?

Please attach a little sample...

Posted

I attach file now. It's another file but same fields and scripts. I couldn't search for Plant name and Title, only process type. I hope to get solution soon.

Thanks again

Snow

sample.zip

Posted

Snow,

The easy way ----> Se Error Capture at start of your script

Now, even without "Set error capture (on)", you'd be able to find at the condition that the three fields aren't empty.

So....

The complicated way :

If is Empty(your global field)

New Request

Else

Set Field (your text, your global).

Of course, go for simplicity.

Posted

Hi Ugo,

I put "set capture on" at start my script and it found all of names. I used the complicated way and it also showed all of names, not only the name I want. Is there something wrong in my script?

Snow

Posted

Hi Snow,

Really no idea what I've been doing....

This one works, while it is EXACTLY the same as the one you posted. No need for any error capture.

I spent the last 30 minutes turning around your file.

No clue

sample.fp5.zip

Posted

Hi Ugo,

Thanks for your help. Your attached file really works well but I don't know why I did exactly as you did for my old file, it still doesn't work. I attach it now so that you can see the same file you corrected but it didn't work. I wonder where I made a mistake??

Thanks again

Snow

sample.zip

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