Is it possible to concatenate different value strings and storing in different variables


Badge +6

I get First Name and Last Name for the users and want to create Full Name by concatenating First Name + Last Name.  I use "Build String" to achieve this functionality.  However, I have many users and need to use Build String separately for each user.  Do Nintex have any action which can give this functionality or any procedure to achieve his.

Just a thought, why not "Build String" have an option of adding multiple strings and storing in different variables?

Cheers:)

Sunil


15 replies

Badge +11

Hi Sunil,

by default this is not possible, you normally have to use separate "build string" actions.

However, how are your users entered in your form? You could try to put all your first name/last name information into a collection variable. Afterwards you could use a "for each" loop and use only one build string action inside this loop. But if that is applicable for you depends on how your names are entered.

Cheers

Philipp

Userlevel 5
Badge +14

can you post an example what are trying to do?

as well, clarify how/where do you store your list of user first and last names.

that's how build string action is designed. you may place an idea on user voice portal @voice to extend its functionality.

Badge +6

Thanks Philipp and Marian,

I query to SharePoint for user names through action "Query User Profile" and stores First Name and Last Name in two separate workflow variables.  I did not find full name stored in SharePoint.

189506_pastedImage_0.png

Then use "Build String" to concatenate two workflow variables and store in one workflow variable.  This I have to repeat for all the users.

189507_pastedImage_1.png

Badge +11

I presume your "Product Manager" is a user field in your sharepoint list?

Then you dont even need to query the user profile but you can get the display name of this user by using the "set variable" action:

By hitting the "..." you can define the return data type of your field. When using a user field you can decide to receive e. g.  display name or login.

Cheers

Philipp

Badge +6

Hi Philipp,

This is very useful tip.  However, it does not serve my purpose.

First Name : Sunil

Last Name : Tamanekar

So it should give me : Sunil Tamenekar

By using Created By - Display Name it gives me : Tamanekar, Sunil {FPCE~Mumbai}

Cheers

Sunil

Badge +11

Well, this is how the display name property is set inside the user profiles.

So the only workaround i can imagine is to store all your items user fields inside a collection and use a for each loop as mentioned above.

Userlevel 6
Badge +12

Hello Sunil Tamanekar​ -

Are you running this on a list or a site workflow? How are you getting the user names?

As mentioned by Philipp Lucas​, you can easily get a collection of first names and a collection of last names, then using a For Each loop action, create your string and do what you need with it.

Let me know if you need some assistance with setting that up and I can mock something up if you need to walk through it.

Hope this helps!

Userlevel 5
Badge +14

just my 2 cents...

why to complicate things and not to use display names provided by AD?

users are used to work with that names from other applications bound to AD, so why not in nintex/sharepoint?

in big(ger) environments it's rather useful to be able directly recognize the person by that kind of extensions or match them with those other applications.

Badge +6

Hi Jesse, Marian,

@Marian, I do agree with you.  We can use display name, I was trying different options to achieve the functionality and the logic may be useful for some other requirement.

@Jesse, We are using List workflow.  I really appreciate your help.  I have not worked on Collection Item, kindly help me to set up the process.

Cheers:)

Sunil

Userlevel 6
Badge +12

Sure thing Sunil Tamanekar​ -

How are you getting user names? From a form? Is it a single user or multiple users in the same field? Is it a user group?

Badge +6

Thanks Jesse,

The sequence is as below:

1.  I collect user id in the form and store in list item variable.  It is a single user in in one field.

2.  Then query to SharePoint user profile by the action "Query User Profile" and get User First Name and Last Name:

190065_pastedImage_0.png

     "First Name" and "Last Name" were selected from the Properties to retrieve dropdown list and stored in workflow variables separately.

3.  Then used "Build String" to create full name.

This is the process I use to get First and Last Name and then concatenate.

By the way, you asked about user group.  I will be great full if you give me details about user groups and how to get user names of the group.

Cheers:)

Sunil

Badge +11

I would use a foreach and loop through the items concatenating use the build string into a variable and then adding that variable to a collection variable. Then you would have a collection of users with first and last name.

Badge +11

Oh....I didn't realize you were using a People Picker.

Userlevel 6
Badge +12

If you are only going after one user at a time, this is a perfectly acceptable way of accomplishing what you want to do. You can also do it by using a Set Variable action like this:

190110_pastedImage_0.png

same thing for last name:

190111_pastedImage_1.png

From there you can either do a Build string and put them together into one variable, or simply use both.

190113_pastedImage_3.png

I thought you were getting multiple users and had to get all of their first and last names and do something with it. In that scenario, you would want to use a loop, but since you are going after one user, this is a much simpler approach.

Let we write up something for doing this against a UserGroup (using a loop and collections). I have a working example (somewhere in my test environment!) and can put together a "how to" for you.

Hope this helps!

Userlevel 6
Badge +12

Sunil Tamanekar​ -

I wrote up a quick workflow if you want to get all user first and last names from a user group. I detailed my steps in the blog Get All User First & Last Name's from User Group . I also attached the .nwf file so if you want to grab it and follow along you can.

Let me know how it works out for you.

Hope this helps!

Be sure to mark your question as answered if you found a working solution so others can quickly find it!

Reply