Truncate the length of field value in flat file schema problem

Hi,I have created the ff schema and i am converting the ff document to string using pub.ff.covertToString service. we are using delimiter flat file schema .But here twist is the values written in file should be some limited length for example:ffDoc is having 2 fields 1)Name (value=abcd)& 2) Department (value=xyzpqrst)Now i am converting this into string and writing into file which we need to send to third party system. but they are having restriction on fields.Like they say that maximum length of value of Name field should be 3 char && max value for Department filed should be 5 char…In all they wants like:NameabcDepartmentxyzpqSo can i impose any rule on schema to achieve this??Please suggest me best way…Thanks

You have to do that in the mapping logic written in the flow services before invoking convertToString service. You can perform validation while parsing/creating ff, or you can set some default value to fields using schema but not transformation.


As Senthil recommends - I’d add a recommendation to put the mapping logic into a separate service - do not simply embed the truncating logic in a map step… That way you can properly unit test your mapping logic and consider the various input scenarios…

You also have to be careful about simply truncating values - it will create problems down the track in terms of data matching across systems.

Nathan Lee

dude just take length of fields and use leftPad or rightPad services to truncate string. this logic is to be implement in map step.

Thanks to all…