I've wanted to build a tool to export out certain files to an XML file so that they can be read into a blank set of data for when we build templates for new customers.
So I built the view that builds the XML file, but having some struggles getting the Save to work when reading it back in.
I am hoping that somebody can spot why my save doesn't take place. In debugging, the processing reaches the Request_Save line and returns error free. I have also validated the data that is set in the Field_Changed_Value is correct
Code:
Function fSaveFileRecs String[][] sRecord String sMode Returns Boolean
Integer iField iFile
String sValue
Handle hTable
String sField
Integer iFields i
Handle hoDD nTable
Integer iCount iLength iTest
String sFileNumber sFieldNumber
Boolean bErr
Get Create (RefClass(DataDictionary)) to hoDD
Move (Left(sMode,14)) to sMode
Move (Right(sMode,3)) to iFile
Set Main_File of hoDD to iFile
Send Clear_Main_File to hoDD
//Move iFile to hTable
Move (SizeOfArray(sRecord)) to iFields
For i from 0 to (iFields-1)
Move sRecord[i][0] to sField
Move sRecord[i][1] to sValue
Move (Left(sField,5)) to sField
Move (Right(sField,3)) to sField
//Send AppendTextLn to oLog ((String(iFile))+' : '+(String(sField))+' : '+sVALUE)
Move sField to iField
Set Field_Changed_Value of hoDD iField to sValue
Set Field_Changed_State of hoDD iField to True
Loop
Set Changed_State of hoDD to True
Get Request_Validate of hoDD to bErr
If (not(bErr)) Begin
//Set_Attribute DF_FILE_CHANGED of hTable to True
//Get Server_File of hoDD to iTest
//Get Main_File of hoDD to iTest
//Send Info_Box (String(iTest))
Send Request_Save to hoDD <--- This gets called but nothing gets saved.
//Send Save_Main_File of hoDD
Move (Err) to bErr
End
If (bErr) Begin
Send AppendTextLn to oLog '----- Error Saving ---------'
For i from 0 to (iFields-1)
Move sRecord[i][0] to sField
Move sRecord[i][1] to sValue
Move (Left(sField,5)) to sField
Move (Right(sField,3)) to sField
Send AppendTextLn to oLog ((String(iFile))+' : '+(String(sField))+' : '+sVALUE)
Loop
End
Send Destroy of hoDD
Function_Return True
End_Function
I am hoping somebody can spot something or add some advice. If all of that fails, then I pray to god for a "Worsely-effect" to take place since I've been fumbling with this for about 8 hours.
M