Your script is very seriously flawed.
I would not say your script is simple.
I would say your script is pretty much incomprehensible.
You never declare variables $F1, $F2, $F3; so they are empty.
First you go to a layout.
You create a new record.
You set fields to values you have not declared.
You have an if statement evaluate an error; but the if statement doesn't do anything.
You should sign up for some FileMaker training, or find some way to learn a LOT more about FileMaker scripting.
YEs I understand why you think so badly of my script: I only sent s piece of it with the idea to make it simpler
will send complete shortly
The complete script is:
So, I think this is very clear now. At least a bit better.
Appreciate any ideas...
As I say, the only Find does not always find the record even if it exists... the search is donde over the nombreConcepto field of the T06_Conceptos table occurrence (an anchor)..
Step thru the script with the debugger.
What does $F2 contain right before the Enter Find Mode script step?
Performa manual fiind on layout L60_Conceptos and see what you get.
Remind us - you have FileMaker Pro Advanced and you know how to use the script debugger?
Yes I have FM Pro Adv...
The script should be clear if I explain:
the outer loop creates statement lines, and each time we set the LINE_CONCEPT we look for a Concept to match (from T06_Conceptos)... this is the only Find in the script. The problem is that sometimes the Find does not find the Concept record even though it has been created in a previous iteration of the loop. This creates duplicate record in the T06_Conceptos table which is wrong.
Can you see?
Thanks for all your help,
the set variable $f2 trimall script step could be removing a space changing the value ie there is a first and last name in that Value.
If he ran the script with the debugger and answered my question he would also answer yours...
What I find in $F2 before the Find, is
VICTORIA'S SECRET CATA\08008881500
which exists in the table of T06_Conceptos but cannot be found, not even in a MANUAL Find....
so I think it has something to do the "\" character right?
Seems to me the text is stored diferently?
May be the solution to my question!
Just a thought, you're using TrimAll on the $F2 variable for the find. Does the actual field that has the data have any extra space/returns in them?
So, to thank you all, I thought I shared what was going on with the Find.
Not for every concept, just a few, the Find couldn't find concepts that existed in the Concepts table. Why?
Well, the value I placed in the concept field in order to search had special search operators (like \) and thus would not find the match. So all that was needed is for each possible operator used in a Find (=,==, etc), escape them using Substitute and search with this modified fields. It works!
Thanks to all of you!!