How to read data from pipleine, where variable name change during runtime?

Hi

We have a requirement where the field names under a document can change during run time and data needs to be read from those fields. How to achieve this in flow service?

Document
Field-1
Field-2


Field-N

As shown above, the number of fields under Document can change during run time and we want to read data from them and use it further.

At beginning of the flow, we will know how many fields are expected under document and we can repeat that many times to read the data. But how to substitute the field names during runtime, as this may change like Field-1, Field-2 …Field-N.

You can get more information on IData object using the IS Java API documentation.


ArrayList<IData> outputDocarr = new ArrayList<IData>();		
		IData	inputDoc = inDoc;
		if ( inputDoc != null)
		{
			IDataCursor idc=inputDoc.getCursor();
			IData output=null;
			IDataCursor idcOut=null;
			
			while(idc.next()){
				output= IDataFactory.create();
				idcOut= output.getCursor();
				
				if ((idc.getValue() instanceof String) ||((idc.getValue() instanceof Object))){
					IDataUtil.put(idcOut, "key", idc.getKey());
					IDataUtil.put(idcOut, "value", idc.getValue());
					idcOut.destroy();
					outputDocarr.add(output);
				}
				else if(idc.getValue() instanceof IData){
					idc.next();
				}
			}
		}
return outputDocarr.toArray(new IData[outputDocarr.size()]);