andrewg
Scout

Re: How to concatenate string/variables?

Jump to solution

Good to know it doesn't behave well doing so. But doing this method of putting them together would be a way that you build a long string of all the rows, or a string of all Costs or Qty. You wouldn't use a dictionary with that example.

I think the problem is now there are too many examples. I was hopping to give you options so you could choose what was best for you. But it looks confusing now. So after this one post an image of what you have if there is trouble.

Could you:

  • Query XML to output the 4 individual values into 4 variables within the loop
  • combine the 4 variables into one (row)
  • add to dictionary
  • loop
0 Kudos
Reply
Not applicable

Re: How to concatenate string/variables?

Jump to solution

Hi Andrew,

Thank you for not giving up on me.

I have done as you said with the 4 points.

1. QueryXML and output results into 4 separate variables. “var1,2,3,4”

2. Combine the 4 into 1 string using “Set Workflow Variable” mystring = “var1 var2 var3 var4”

3. Store the variable into a dictionary using “Build a Dictionary” Key1=mystring

4. Loop the second time.

From my testing my dictionary just gets overwritten with each iteration. It is not creating a new ‘row’ in the dictionary.

Thank you for your time | Andrew Huddleston | Hillsong church | +61297753601

0 Kudos
Reply
andrewg
Scout

Re: How to concatenate string/variables?

Jump to solution

Nooo! Interesting. I've used this method myself before. Could you post some information around this area. Screenshots or NWF

0 Kudos
Reply
Not applicable

Re: How to concatenate string/variables?

Jump to solution

Here is a sample wk.

Below are the actions explained.

1. Loop with a condition

2. I write to the log the first iteration of the loop.

3. I build a dictionary using “row ” which is “row 1”

4. I then increment my index

5. Now I loop back to the second iteration.

Here is the workflow history.

You can see here, that the first iteration logs Iteration number 0, {"Key 1":"row 0"}, then the second iteration writes over it with {"Key 1":"row 1"}.

I would assume the dictionary is supposed to build a second row or not?

Thank you for your time | Andrew Huddleston | Hillsong church | +61297753601

0 Kudos
Reply
andrewg
Scout

Re: How to concatenate string/variables?

Jump to solution

OK, I have a working example that I believe will work for your situation. I must first apologize that I was wrong about dictionaries and using it in this way. You can't use a dictionary like a collection. And that's too bad.

But the other method of concatenating values works just fine, you just need to give the variable an initial value.

Since this will go in an email I used HTML in the variables to help format the data.

In my workflow example I have 4 variables

  1. tempRow
  2. Item
  3. Cost
  4. Qty

All text values. You will get the values through the Query XML action, but here i simply assign them a value.

I first set the tempRow variable to the start of an HTML of a table

Capture1.PNG

Then I have a loop that is looping twice to set the variables (they will have the same values on each run here)

nintexLoopConcatenate.PNG

The last action sets the variables to the temp row

setTEmpRow.PNG

See here I am working the HTML to show i'm adding another row, also i'm setting tempRow = tempRow Item Qty Cost

Now after loop I have a two actions

1. Set variable - I set tempRow = tempRow </table>   (to close out the html)

2. Send Email

In the email action I simply add the tempRow variable

nintexConcatEMail.PNG

The reason I set the HTML in the variable itself and not have the header and table open and close HTML defined in the email is because of how the HTML editor works as a wysiwyg. It moves your HTML and does not allow you to define variables in the middle of open and close tags of HTML. So you should define it in the variable and it gives the expected result.

So the email result looks like

nintexResultEmail.PNG

A nice pretty table in an email!

I hope you can take this and make it work for you too.

Reply
Not applicable

Re: How to concatenate string/variables?

Jump to solution

Hi Andrew, it's morning time here and I am sitting on the loo and want to hug you!!!! Thank you very much.

This absolutely looks like a winner.

It also raises a question as I believe I did this exact thing already except I didn't use HTML, I tried just using DIVs. I must have done something wrong obviously though..

I can't wait to whip out the laptop and try this, and take our company forward to the next level!

Thanks Again Andrew

Reply
andrewg
Scout

Re: How to concatenate string/variables?

Jump to solution

Any luck? You may have only needed to provide an initial value to the reused variable.

0 Kudos
Reply
Not applicable

Re: How to concatenate string/variables?

Jump to solution

Hello Andrew,

thank you so very much for sticking this out to the end.

I now have a working WF using the a=a+b method above.  I also did remove a "Get value from Dictionary" action which was causing trouble.

Thank you again

Reply
isabellamai
Scholar

Re: How to concatenate string/variables?

Jump to solution

@andrewg - I know this post is old, but I was hoping you can provide some screen prints on how to do concatenate string/variables. I have 3 collection variables (date, comments, editor) and do not know how to build a string that will show for each item within the collection:

 

 Row1 = "Item1 Cost1 Qty1 Total1

 Row2 = "Item1 Cost1 Qty1 Total1

 Row3 = "Item1 Cost1 Qty1 Total1

etc.

 

Thank you.

0 Kudos
Reply