0 Replies Latest reply on Jun 4, 2018 5:19 AM by mayur marathe

    assigning column values based on their field name

    mayur marathe Seasoned Veteran

      Hi

      I need one help in java transformation java code , i am fetching the data from url like below

      http://uat1.abc.portal.risk.abc.com/dif/data/partyXref/1.0.0?attributes=ORG_ID%2CLEGAL_NAME%2CHASHCODE

       

      i have written the code by assuming that the data from rest api will come as same sequence provided in url ( ORG_ID,LEGAL_NAME,HASHCODE )but while we are receiving the data ( LEGAL_NAME,ORG_ID,HASHCODE )

       

      so now what i have to do is assign the values to output port based on the columns coming , till now i am skipping the first line i.e header now i have done code like

       

      if( linenumber ==1)     ---first line is header

      {

        string[] header =inputline.split("//|");

        for (i=0,i<=header.length;i++)

        {

          if(header[i].equalIgnoreCase("ORG_ID")

         {ORG_ID_POS = 1}  -- ORG_ID_POS is variable created

         ------

       

        }

      }

      else if( linenumber >1)    -- from line 2 pipe seperated data will start

      {

      string[] data =inputline.split("//|");

      here i need to compare if the column is coming as ORG_ID  then assign it to   output port of ORG_ID and so on

      }

      need help in assigning the values in else if block dynamically according to first block output