Extract sub-string from filed and contact it

Dear ODK Team.

I needed solution as mention in attached screenshot.

Wanted

I will be really grateful to you

Regards,

32365-0101562-1

If the CNIC prefix (eg 32365) is always a fixed 5 chars, and the CNIC ID (eg 0101562) is always fixed 7 characters, then you could use substr() to extract the fixed ranges of characters corresponding to the ID.

Otherwise, if either or both these are variable length, then you could extract the portion of the string between the two hyphens using a suitable pair of substring-after() coupled with a substring-before().

1 Like

Thanks Xiphware..

CNIC ID (eg 0101562) is always fixed 7 characters.

I am using this::
concat(/data/Name,'-',substr(/data/CNIC,7,13))

Using substing for CNIC ID and concat with Name.
But facing issue.

Regards,

Thanks Sir.
It's work.

Using::

concat(/data/Name,'-',substr(/data/CNIC,6,13))

Regards,