Jump to content
Server Maintenance This Week. ×

Set Field


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

Recommended Posts

I am at my wits end on this one. I have 2 files that are linked with a "constant" relationship. One file is a "holding tank" for production numbers that are being entered in the main file. When the user clicks on "submit button" in the main file some of the information needs to go to the "holding tank" file. I have a set script that sets all of the fields in the "holding" file with information from the main file. The script resides in the "holding" file and when the user clicks on the submit button in the main file it calls for the external "set" script which is ???

Enter Browse Mode

Set Error Capture (On)

If (Main:Hourly production >0) (This steps checks to make sure that production is entered to complete the script)

New Record/Request

Set Field (A, Main:A)

Set Field (B, Main:???

Set Field (C, Main:C)

Set Field (gcurrent, Status(current error)

Else

Exit Script

End If.

My problem is that it will not set field C with the information. It leaves it blank. I put on the error capture and the result is "0". I cannot understand why it will not set field C. Field C in the main file is a number field as it is in the "holding" file. The only thing I can think of is that in the main file Field C is a conditional value list, but the data that is entered in C should still be set , right?

Help.

Link to comment
Share on other sites

How many records in the Main file? If the relationship is constant it will pick up the values from the first match, not necessarily the current record.

However, as you not it sets A and B. Turn off error capture and run the script and see what happens.

Let us know, then maybe we can further diagnose. Also be sure that field types are exactly the same in both files.

Old Advance Man

Link to comment
Share on other sites

There are 100 records so far in the main file. Both "C" fields are formated exactly the same. I tried the script with the error capture off and I get the same result. I also tried turning off the indexing for the "flag field" and it then would not set any information. Is there another way around this besides cut and paste. My main file has 7 other small files working with it besides the holding file and none of the other databases can be "viewed" by the users. The data being transferred to the "C" field in the holding file is data needed to generate daily, monthly, and yearly reports.

Link to comment
Share on other sites

The problem is likely with the constant relationship. Create three globals fields in the main file to match the A, B, and C fields. have the script set the values from A, B, and C into the correeponding globals.

SetField "global_A", A

THen access the globals from the other file to have the data set into the records there.

HTH

Old Advance Man

Link to comment
Share on other sites

quote:

Originally posted by MEG:

I am at my wits end on this one. I have 2 files that are linked with a "constant" relationship. One file is a "holding tank" for production numbers that are being entered in the main file. When the user clicks on "submit button" in the main file some of the information needs to go to the "holding tank" file. I have a set script that sets all of the fields in the "holding" file with information from the main file. The script resides in the "holding" file and when the user clicks on the submit button in the main file it calls for the external "set" script which is
???

Enter Browse Mode

Set Error Capture (On)

If (Main:Hourly production >0) (This steps checks to make sure that production is entered to complete the script)

New Record/Request

Set Field (A, Main:A)

Set Field (B, Main:
???

Set Field (C, Main:C)

Set Field (gcurrent, Status(current error)

Else

Exit Script

End If.

My problem is that it will not set field C with the information. It leaves it blank. I put on the error capture and the result is "0". I cannot understand why it will not set field C. Field C in the main file is a number field as it is in the "holding" file. The only thing I can think of is that in the main file Field C is a conditional value list, but the data that is entered in C should still be set , right?

Help.

Link to comment
Share on other sites

  • 2 weeks later...

OK, so I read this thread and I got the Set Field script step to work correctly in my application, but I'm still confused. I began this undertaking believing that all I had to do was use Set Field to set the contents of a field in File B to the contents of a field in File A. I could never get the field to set any value.

I studied the examples in Scriptology (book) and in Schwartz' book, I read this forum in depth and I was sure I was doing it right but it just never worked. I finally resorted to using a global and it worked just fine. (I did get it to work with copy-paste but that wasn't what I wanted, for a number of reasons.)

I saw several places on this board where people were having trouble Setting a Field to the value of a field in another database. Does this just not work? Is it a known bug? If not, what (perhaps undocumented?) condition has to be met before it will work correctly?

Link to comment
Share on other sites

Stop! Set Field() is 100% reliable!

It is just being used improperly. The contant relationship should not be used to set anything except GLOBAL fields in a related file. This is the cause of your problems. If you want to set other than global fields, use a two step process:

In your first file ---> Set Field(GlobalField, RealField)

then in the second file ---> Set Field(RealField2, ConstantRel::GlobalField)

-bd

Link to comment
Share on other sites

quote:

Originally posted by LiveOak:

Stop! Set Field() is 100% reliable!

It is just being used improperly. The contant relationship should not be used to set anything except GLOBAL fields in a related file. This is the cause of your problems. If you want to set other than global fields, use a two step process:

In your first file ---> Set Field(GlobalField, RealField)

then in the second file ---> Set Field(RealField2, ConstantRel::GlobalField)

-bd

I agree with LiveOak. The Set field script step is 100% reliable. The problem Meg was running into was that, by using a "constant" relationship, she was Setting fields in the first record of the related file regardless of her creation of a New Record in the related file.

Link to comment
Share on other sites

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