Variable not being updated


#1

Hello,

Bellow is a photo that I will explain step by step.

(1)JobNumber is declared as a string and initialized with “00”: JobNumber = “00”
(2)Then we go through each row of a datatable.
(3)Then we reassign JobNumber with a result from the 2nd column in the row: JobNumber = row(1).ToString.

(4)We print out the result of JobNumber inside a variable that concatenates JobNumber.
(jobFilePath = "Something Here " + JobNumber)

Let’s assume that row(1) contains “526”.
Message Box should print (“Something Here 526 526”).

Instead Message Box prints (“Something Here 00 526”).

This isn’t the first time i’ve come across this error. I’m not really sure what the quickest way of fixing this problem is. Sometimes I have to create a brand new workflow in order to resolve the issue. Has anyone else encountered this problem? Also what is the most feasible solution to this problem?


#2

@r0manred: Check the properties of your second assign, if it still has “00” then update it. Also, print the value of row(1) to verify if that is coming as 00


#3

Hi @r0manred,
1. Check the JobNumber by MessageBox before asign.
2. To concatenate value use " & " like JobNumber= JobNumber & " " & row(1).ToString.
3. Again verify the JobNumber by MessageBox.

If possible, can you share the source.

Regards
Balamurugan


#4

row(1) has value “526”. Everything is validated.

The difference in concatenating is irrelevant.

Please read step by step approach and look at code/workflow.


#5

Hi @r0manred,
In the work flow you are assigning the value . not concatenating. and try with & symbol.

Regards
Balamurugan.


#6

Hi @r0manred,
I have attached a sample with if condition inside the loop. May be it can help you.

File : Variable.zip (2.1 KB)

Regards
Balamurugan


#7

Sorry, I see what you mean. I did this and it fixed the problem.

I guess i’m having a hard time understanding why I have to do this all of the sudden when I was not coming across this issue before hand.


#8

Can you attach the workflow