Attached is the screen shot for the values that I am passing in ffValues document.
As a output of ConvertToString service I am getting below string, which is not expected. I want to extract name and age field. Can anyone please let me know what is wrong here?
In the Flat file schema definition , In the bottom section there will be Record Identifier section which is by default set to Starts at position zero. Which is causing this issue.
If you want the record identifier to appear in the result string , Put the appropriate value where the record identifier should come and accordingly update the positions of the fields in the flat file definition.
If you donot want the record identifier to appear in the result string :
You can use Dictionary , create record definition in the Dictionary and set the record as the Default record in the Flatfile Schema
Or update the config to not add the record identifier in the result String. From Documentation it says
The FF config file is present at the following location Integration Server_directory\instances\instance_name\packages\WmFlatFile\config\ff.cnf
In ConvertToValue service I am passing string EmpDetails,A,b,c,d,e,f,i,g,h,i,j,k,l,ABC,28 as input. Here EmpDetails consider at 0th index and in ffValues document I am getting recoredID as EmpDetails because record Identifier starting from 0th index.
Now, I am using the ConvertToString service to convert this ffValues document into string and I am getting below string in output.
EmpDetails,ABC,28 Here I am able to extract name and age both the field.
I want to understand After ConvertToString service why I am not getting the string values which I passed as input to ConvertToValue
The record identifier , as the name says it should be present in each record.
So, if you are using , as field delimier , CRLF as record limiter and your flatfile is Nth field based. Then select record identifier to start at nth field (where n can be any whole number ).
In the below example , I have selected n=2nd field for record identifier , 0th for the Employee Name field and 1st for Age field.
Rakesh,12,EmpDetails
Kumar,15,EmpDetails
Tiwari,27,EmpDetails
ABC,29,EmpDetails
XYZ,56,EmpDetails
When I parse this data, it will parse correctly using converToValues service . And correct String is being generated using convertToString service.
If you are not sure whether any record identifier will be present or not in the flat file. Then better go with the approach of using dictionary i.e recordWithNoID approach.