Apologies for the late response: my internet (thanks, Comcast!) was down for two days, then off on the Holiday circuit!!
Thanks for reminding me Bruce: I did copy/paste from a .pdf a few weeks ago and promptly forgot that's how I did it... I definitely suspect my problem is actually with GetField vs GetRepetition. FieldMaster table is a table with the fieldname and descriptive data for each field in the table I want to convert from. Some of the records are identified as "Class" records and I am only working with those in this script. The FieldName field has the fieldname of each column in the table I am converting...(duh-h-h). ConvertUVMC is the table to be converted: some 800 fields, 400+ of which are Class fields. Some of those Class field have 1 repetion, some have up to 4. FM Pro 8.5 Windows Script 1 UpdateFieldMasterClassTerm #Search FieldMaster for every instance of a class, pass to lookup of ConvertUVMC to extract non-empty fields and write to ClassTerm Freeze Window Go to Layout [ "FieldMaster" (FieldMaster) ] Go to Record/Request/Page [ First ] Set Variable [ $$vfirsttime; Value:1 ] Loop If [ FieldMaster::TableNames = "Class" ] Set Variable [ $$vfieldname; Value:FieldMaster::FieldName ] Set Variable [ $$vnorepeats; Value:FieldMaster::NoRepeats ] Set Variable [ $$vprogramname; Value:FieldMaster::FieldNameRemainder ] Set Variable [ $$vyear; Value:FieldMaster::FieldYear ] Set Variable [ $$vschool; Value:FieldMaster::Town ] Set Variable [ $$vsession; Value:FieldMaster::Session ] Perform Script [ "UpdateFieldMasterClassTermConvertUVMC" ] End If Go to Record/Request/Page [ Next; Exit after last ] End Loop Script 2 UpdateFieldMasterClassTermConvertUVMC #Go to named column in ConvertUVMC and transfer data to ClassTerm record(s) Freeze Window Go to Layout [ "ConvertUVMC" (ConvertUVMC) ] Go to Record/Request/Page [ First ] Loop Set Variable [ $$vhhid; Value:ConvertUVMC::HouseholdID ] Set Variable [ $fld; Value:GetField($$vfieldname) ] If [ $$vnorepeats = 1 ] Set Variable [ $$vvalue; Value:$fld ] If [ not IsEmpty ( $$vvalue ) ] // If [ Length($$vvalue) 1 and $$vvalue " 0 ] Perform Script [ "UpdateFieldMasterClassWriteTerm" ] End If Else Set Variable [ $vloopcntr; Value:$$vnorepeats ] Loop Set Variable [ $$vvalue; Value:GetRepetition ( $fld;$vloopcntr) ] If [ not IsEmpty ( $$vvalue ) ] // If [ Length($$vvalue) 1 and $$vvalue " 0 ] Perform Script [ "UpdateFieldMasterClassWriteTerm" ] End If Set Variable [ $vloopcntr; Value:$vloopcntr - 1 ] Exit Loop If [ $vloopcntr < 1 ] End Loop End If Go to Record/Request/Page [ Next; Exit after last ] End Loop Close Window [ Current Window ] The 3rd script is outputting records OK but the data comes from the first 2 scripts. Thanks! Ron
