GuenterP,
Here is the code // in Save Button nReturn is int sErrorMessage is string ="" sErrorField is string ="" bTransaction is boolean=False
nReturn=CheckRequiredFields(sErrorMessage,sErrorField) // To check for must input fields IF nReturn=0 THEN // found an incomplete field ToastDisplay("You haven't filled all the fields",toastLong, vaMiddle, haCenter) ReturnToCapture({sErrorField}) END
nReturn=DuplicateCheck(sErrorMessage,sErrorField) // To check for duplicate values IF nReturn = 0 THEN // found an duplicate field ToastDisplay(sErrorMessage,toastLong, vaMiddle, haCenter) ReturnToCapture({sErrorField}) END
nReturn = CheckInactiveValues(sErrorMessage, sErrorField) // To check for inactive Country IF nReturn=0 THEN // found inactive country selected ToastDisplay(sErrorMessage, toastLong, vaMiddle, haCenter) ReturnToCapture({sErrorField}) END
// transfer screen data to the record structure ScreenToSource()
HOnError("*",hErrAll,"") IF HTransactionStart(ClassicDatabaseTRS) = False THEN sErrorMessage="problem starting the transaction ..." bTransaction = False Info(sErrorMessage) ELSE bTransaction = True END
IF bTransaction = True THEN IF HReadSeekFirst(State,usGUIDState, r_State.usGUIDState) = False THEN // Navigating to the record, to update sErrorMessage = "State record not found" + r_State.usGUIDState bTransaction = False Info(sErrorMessage) ELSE bTransaction = True END END
IF bTransaction = True THEN State.bNotActive = r_State.bNotActive // Just modifying one field IF hModify(State) = False THEN sErrorMessage = gpoDB.GetErrorInfo() bTransaction = False ELSE bTransaction = True END END
IF bTransaction = True THEN FOR EACH District WHERE sStateFK = r_State.usGUIDState District.bNotActive = State.bNotActive IF hModify(District) = False THEN sErrorMessage = gpoDB.GetErrorInfo() bTransaction = False END END END
IF bTransaction=False THEN HTransactionCancel() Error(sErrorMessage)) ReturnToCapture(EDT_State) ELSE HTransactionEnd() END
// Error Error at line 35 of Method MakeRecordContent process The HFSQL file or link named 'AliasState' is unkown.
////////////////////////////////////////////////////
The above code works fine when I update the state for the first time. GetAlias function, available in WXReplication, is storing the aliasname in an array. When I try to update the same file second time, that function returns the alias name from the array, then I get the above error.
Don't have problem in updating one file. Don't know whether it's the right way to call to update two files within transaction. /////////////////////////////////////////////////////
To test, I created one procedure which will accept a state name, modify that state and all districts under that state. This is for testing purpose only. It modified all 4 states, corresponding districts without any problem.
sErrorMessage is string ="" bTransaction is boolean=False
HOnError("*",hErrAll,"")
IF HTransactionStart(ClassicDatabaseTRS)=False THEN sErrorMessage="problem starting the transaction ..." RESULT False END
bTransaction = SP_SetupStates(sErrorMessage) // Creating default states.... IF bTransaction=False THEN HTransactionCancel() ELSE HTransactionEnd() END
SP_SetupDistricts() // Creating default districts ...
bTransaction = SP_StateModify("Andhra Pradesh", sErrorMessage) // Procedure to modify one state and its corresponding districts. IF bTransaction=False THEN Info("Update failed for andhra pradesh" + sErrorMessage) HTransactionCancel() ELSE Info("update success for andhra pradesh") HTransactionEnd() END
bTransaction = SP_StateModify("Assam", sErrorMessage) IF bTransaction=False THEN Info("Update failed for assam" + sErrorMessage) HTransactionCancel() ELSE Info("update success for assam") HTransactionEnd() END
bTransaction = SP_StateModify("Bihar", sErrorMessage) IF bTransaction=False THEN Info("Update failed for Bihar" + sErrorMessage) HTransactionCancel() ELSE Info("update success for Bihar") HTransactionEnd() END
bTransaction = SP_StateModify("Gujarat", sErrorMessage) IF bTransaction=False THEN Info("Update failed for Gujarat" + sErrorMessage) HTransactionCancel() ELSE Info("update success for Gujarat") HTransactionEnd() END
Couldn't figure out where the problem lies. Any help to figure out is really appreciated.
Happiness Always BKR Sivaprakash |