JohnDanter2
VIP Member
Hi folks
Me and my resident OO language geek have written a simple manipulate output script to show a user defiened orchestration output variable as a response (RRDResult) and also a clever way of setting all the Object Line Error info into another variable RRDErrorText'
However we wrote this JRuby but I would like to convert it Groovy. Camn someone help us please?
"RRDResult": "200003",
"RRDErrorText": "O: n55apird.c L: 501 E: 616V CAUSE...Auto Batch Receipts could not be created through the Auto Bank Statement Process (R09616)\n\nRESOLUTION...Review the bank statement for details.\n\n",
Thanks
John
Me and my resident OO language geek have written a simple manipulate output script to show a user defiened orchestration output variable as a response (RRDResult) and also a clever way of setting all the Object Line Error info into another variable RRDErrorText'
However we wrote this JRuby but I would like to convert it Groovy. Camn someone help us please?
Code:
require 'json'
def main(orchAttr, input)
jsonIn = JSON.parse(input)
#Default reponse to be OK
jsonIn['RRDResult']='200001'
#if error detected set to 200003
if jsonIn['continuedOnError']
#set the control variable RRDResult to be in error state
jsonIn['RRDResult']='200003'
jsonIn['RRDErrorText']=
'O: '+jsonIn['ServiceRequest1']['fileName']+' L: '+jsonIn['ServiceRequest1']['lineNumber'].to_s+' E: '+jsonIn['ServiceRequest1']['szerror']+' '+jsonIn['ServiceRequest1']['glossaryText']
end
#if jsonIn['jde__status']=='WARN'
#if 1==1
# jsonIn['RRDResult2']=jsonIn['jde__status']
#end
#Add code here to manipulate JSON output
# jsonIn['szSourceResultField']=200003;
#This bit of code can assign 200003 to the output variable if the inpit variable is not present
# and this will occur if the BSFN ended in error as NO outputs will be present normally
if !jsonIn['szSourceResultField']
jsonIn['szSourceResultField']=200003;
end;
# jsonIn['szUserReservedReference']=jsonIn['RRD_N55APIRD_ORCH.szUserReservedReferenceVO'];
#input['RRD_N55APIRD_ORCH.szUserReservedReferenceVO']
# jsonIn=input.toString();
# if (jsonIn.continuedOnError) [jsonIn['MyResultVO']=200003]
jsonOut = JSON.generate(jsonIn)
return jsonOut
end
"RRDResult": "200003",
"RRDErrorText": "O: n55apird.c L: 501 E: 616V CAUSE...Auto Batch Receipts could not be created through the Auto Bank Statement Process (R09616)\n\nRESOLUTION...Review the bank statement for details.\n\n",
Thanks
John
Last edited: