seanc Posted July 15, 2003 Posted July 15, 2003 This is a little difficult to describe, so I hope it ends up clear enough: I have a database with the following fields f1, text f2, text f3, text f4, text f5, text G_Temp, global text Serial, a unique serial number RK_First, calculation containg "1" There is a relationship (FirstRecord) linking RK_First with Serial to give every record access to record 1. The database has two records. f1 through f5 in record 1 contains column headings f1 through f5 in record 2 contain random text. What I need to do is write a script that steps through the fields in record 2 and sets G_Temp to the data contained in the corresponding column heading contained in record 1 for whatever field it is currently in. An example of the script I am trying to get working: Loop Go to Next Field Set Field ["G_Temp", "FirstRecord::Status(CurrentFieldName)"] Pause/Resume Script[] End Loop Specifying "FirstRecord::Status(CurrentFieldName)" obviously isn't going to work because it look sfor that exact field name... Can anyone see a way to acheive what I'm trying to do? To explain why I need to do this, I actually have more like 5000 fields, and I'm looking for a way to seperate these out into multiple records instead of 1 record with multiple fields. The column heading needs to be applied to each field though. Example: Currently have this database - Record 1 - Heading A, Heading B, Heading C, Heading D, Heading E Record 2 - Data AAAA, Data BBBB, Data CCCC, Data DDDD, Data EEEE Need to end up with new database - Record 1 - HeadingA, Data AAAA Record 2 - HeadingB, Data BBBB Record 3 - HeadingC, Data CCCC Record 4 - HeadingD, Data DDDD Record 5 - HeadingE, Data EEEE I can acheive this by setting another global field to contain the current record number, and using goto record steps to jump back and forth, but I'm wondering if anyone else can come up with something a touch more elegant, and possibly faster. Cheers all, Sean.
_ian Posted July 15, 2003 Posted July 15, 2003 Hi Sean You're looking for the GetField function. In your situation it would work like this: Set Field ["G_Temp", GetField(FirstRecord::Status(CurrentFieldName))] hth Ian
seanc Posted July 15, 2003 Author Posted July 15, 2003 Hi Ian, That does indeed help! Exactly what I was looking for. That makes my script so much better. Many thanks, hope I can return the favour someday. Sean.
Recommended Posts
This topic is 8148 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 accountSign in
Already have an account? Sign in here.
Sign In Now