Showing results for 
Search instead for 
Did you mean: 

UDF for selecting a queue of values.

0 Kudos

Hi Experts,

I am doing a mapping function and is facing issue with a particular filed in the target.

My source and Target Structure are as below




My Mapping condition is if Fuel Type = 03, map source "/MVOldGasRegister/Value"  to  target  "/ZWM_OLD_METER_READING/REGISTER_ID" else if Fuel Type = 01, map source "/MVOldElecRegister/Value"  to  target  "/ZWM_OLD_METER_READING/REGISTER_ID". Else Donot create Target.

The occurance of "/MVOldGasRegister/Value" and "/MVOldElecRegister/Value" is 0..unb. Hence the target "/ZWM_OLD_METER_READING" should be repeated based on the number of occurence of the node. The corresponding "REGISTER_ID" should be of the source.

If Fuel Type =03, then only multiple occurnace of "MVOldGasRegister/Value" would exist with no occurance of ""MVOldElecRegister/Value"

If Fuel Type =01, then only multiple occurnace of "MVOldElecRegister/Value" would exist with no occurance of ""MVOldGasRegister/Value"

I am looking for a UDF to solve this purpose.

Any help appreciated.

Accepted Solutions (0)

Answers (2)

Answers (2)

Active Participant
0 Kudos

Hi Tanzoom,

Below is a sample code.

The UDF should be Context based and input to that should be FuelType, MVOldElecRegister (context should be changed to FuelType), MVOldGasRegister(Again context should be changed to FuelType). The output of this can be assigned directly to "ZWM_OLD_METER_READING" and to "REGISTER_ID" only after "SplitByValue".

void getMeterReadings(String[] inFuelType,String[] inMVOldElecRegister,String[] inMVOldGasRegister,ResultList result....)




  for(int i=0;i<inMVOldElecRegister.length; i++)





  for(int i=0;i<inMVOldGasRegister.length; i++)




Hope it helps!

Best Regards,

Anand Patil

Active Participant
0 Kudos

Sorry if this is obvious - as may have misunderstood what you are expecting as a reply;

You'd need to create a UDF of type "All Values of Context" with your inputs.  Loop through these inputs with your logic above.  eg. for (int i = 0; i < in_parm1.length; i++)

You  output values required with result.addValue(in_parm1.toString());

You can do such things as suppress nodes with result.addValue(ResultList.SUPPRESS) and context changes with result.addValue(ResultList.CC).