Empty values in Document

Hi,

My requirement is to concatenate all the values of all fields in a document.
Eg.
Details
Name — runtime value Naidu
Addr1 — this field is an empty value
Addr2 — runtime value India

The output must be Naidu||India
i.e all the filed values concatenated with a seperator |. Even the empty field needs to be concatenated.

My already tried out ideas –
a. Wrote a java service to parse Idata and values, but the empty values were not part of the pipeline.
b. Tried with FlatFile schema, even this is ignoring the empty fields.

None of the above was successful.

Could you throw in your ideas.

Thank you
/Naidu

Does multiconcat does not work?

What I mentioned was just an example with three fields.

In the actual requirement, number of fields are like >200

So, concat is not a good idea in this case.

Aahhh… :slight_smile:

okkk… Found a solution with FlatFile…

In the service, pub.flatFile:convertToString used option noEmptyTrailingFields

/Naidu

The concatenation can be done with pub.string:makeString, which is not limited to a fixed number of inputs and allows for a separator to be given.

Indeed its a good idea to use makeString. Not sure whether it matches Naidu’s objective :slight_smile:

Hi Martin,

Thanks for your reply. But this service is not workign for the empty values.
As I mentioned –

The output must be Naidu||India
i.e all the filed values concatenated with a seperator |. Even the empty field needs to be concatenated.

/Naidu

If pub.flatFile:convertToString solves your problem easily that’s perfect.

Just wanted to mention that with pub.string:makeString there is a standard multiconcat which is not limited to a fixed input number and comes right with IS.

About the empty fields: For pub.string:makeString as well as most other concat services the important point is the difference between empty, even NULL containing fields and absent fields. That’s why Required and Allow null are two fields in document definitions. If you init the document whose fields you are concatenating with an empty set value before mapping the real values you will find the makeString service working fine, even for the NULL values.

1 Like