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

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

Recommended Posts

Posted

Hi all. I've been using the following script succesfully until suddenly it doesnt work as it either doesn't render the first or the last record or additionally records in between.

Here the script which some very nice people suggested previously:

#

# Replace colon with carriage return for ease of splitting data from label

# Labels are now always odd numbers and their values are even.

Go to Record/Request/Page [ First ]

Loop

Set Variable [ $values; Value:Substitute ( Students::lettertext ; ":" ; ¶ ) ]

Set Variable [ $count; Value:ValueCount ( $values ) ]

Loop

# Set fields counting backwards. Exit loop when done.

ExitLoopIf[$count =Get(FoundCount)+1]

Set Field By Name [ "Students::" & Trim ( GetValue ( $values ; $count - 1 ) ); Trim ( GetValue ( $values ; $count ) ) ]

Set Variable [ $count; Value:$count - 2 ]

#

End Loop

Go to Record/Request/Page [ Next; Exit after last ]

End Loop

#

I am a newbie in this area and tryiong to use the Script debugger gives me a "102" error as I reach the the Set Variable [ $count; Value:$count - 2 ] step.

However the fields are in sound order and I created a simple script to see if the various Values have the same number of chars or any additional mistakes in the student text I receive.

This script tells me all forms land to me properly.

Therefore the imported text files keep exactly the same data format and the various paragraphs end with a carriage return.

Example:

Age: 21

City: Amsterdam

Country: Nederlands

Birth Date: Dec,12 1989

Class: Editors AB

ID: FG34k999L

Group: Sound Editor

Skills: Advanced

Team: Louis

Prvious Score: 87

Computer Graphics: Medium Interest

SFX: Some interest

Previous Student: No

Class: Editors A

Films Weekly: 3

English Proficiency: Advanced

Suggestions: Various lines WITHOUT CRs

Hobbies: Various lines WITHOUT CRs

Something About Me: Various lines WITHOUT CRs

Ideal Homework: Various lines WITHOUT CR

Additional Activities At School Group: Sports

The fields are the basically the same as I receive them as forms where they have some ready made replies to choose from and some larger fields withmax 50 chars which will not accept any carriage return.

The replies are all in English and theyuse UTF8 as encoding language.

I am using Snow Leopard last release with FM extended 11

Could any one please help again?

I receive several hundred forms and I don't know what went wrong.

The forms are converted to txt files in my server and I download them as such.

Thanks

Posted

the Script debugger gives me a "102" error as I reach the the Set Variable [ $count; Value:$count - 2 ] step.

Are you sure about this? It seems much more likely the error is generated by the immediately preceding Set Field By Name [] step.

Posted

I don't really understand how this process works as being illiterate I simply make sure the field names in my DB are exactly the sameas they are in the hundred of mails I receive from my kids.

The kids uploaded their answer to my SQL server and the charset is "windows-1251"as I haver some east europe students using their own Keyboards. Each mail contains the various replies to the 21 questions I ask. Some of the questions have "fixed replies" they choose from pop up menus in the classes web page, Other fields allow writing up to a certain amount of characters and all CR are rejected. They can skip some replies if needed therefore certain question will get a "blanc" reply.

I quote this encoding factor as I am certain each field in each mail matches exactly the field names in the database but I am not sure if the specific encoding for any letter makes a difference while I perform the script.

Importing the the entire mail content happens without problems, no matter which encoding I choose in the import process. I quote this because I see weir chars in some of the mails and I don't understand how the script reacts dealing with any of these non Latin chars.

Is a big problem as I don't know how Filemaker deals with Encodings and or if there is some "cache" storing this process and once an error happens that specific database "remembers it" and trying again lead to errors even if I export the whole file in Unicode8 or Unicode 16 from my TEXT file field convert it again in Text Wrangler and import it again.

Maybe this explain why the script gives the "102" error in certain fields or skips completely some records, or only performs in the first or last record.

I understand this is long and maybe confusing. But I am not very skilled therefore I have no other means to explain any better.

I wonder if there is some kind of counter step I could add to the script telling me the value of the " $values" and the "$count" so I can trace better what goes wrong.

I add to add an additional script step before the end of the loo

Set Field [students :: Additional Activities At School Group; Right (Students :: Additional Activities At School Group; 15)] in any case as it seems as if the script never works for the last field. I used the "15" value as this is the longest possible reply I can receive.

Thanks a lot and kind regards

For your help.

Posted

I cannot say for certain without seeing the entire picture. However, this is my best bet:

Set Field By Name [ "Students::" & Trim ( GetValue ( $values ; $count - 1 ) ); Trim ( GetValue ( $values ; $count ) ) ]

tries to set a field in the Students table whose name is calculated from the $values parameter. For example (using the data in your first post), when the loop counter has reached 20, it will try to set a field named "Prvious Score". If the Students table does not have a field with exactly this name, you will get error 102 (Field is missing).

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