Copy from excel paste into inside query

Dear Experts,

I want to increase the value of inside of the query in text file?

Is it possible ?

For Example:

In the place of % I want to iterate up to 1 to 33
I want to execute same query

put an integer variable and increment and iterate it.

2 Likes

@Abubakkar Yes it is possible.inside a loop You can use string formatting and use {0} in place of the value thar needs to be changed.
Eg: abc.txt has the following content
I am {0} years old.
Read the text file and store it in string variable
Use a while loop with condition i<=33
String.format(string variable, i)

Output will be as follows:.

I am 1 years old
I am 2 years old
.
.
.
I am 33 years old

1 Like

@Abubakkar if this solved your problem then pls mark this as solution

1 Like

Thanks for the solution @rahul.lakshmanan.

You are welcome :slight_smile:

1 Like

@rahul.lakshmanan

just i got a error

The condition should just have i<=33 and in the body of the while loop add a write line activity with values as
String.format(your variable, i.tostring) and increment the value of i using assign activity i=i+1

1 Like

Thanks @rahul.lakshmanan
It’s successfully changed in write line activity but now i want to save 33 text files this and use 33 execute query activity

is it possible ?

Yes just pass the String.format(string variable, i.tostring) as the sql for the execute query activity

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.