Starts with write line

Hello,

i need a help for the below
code qty ID
212345 anything 100
14565 kg 1
14564 no 2

image

if code starts with 2 qty anything that ID should be 100
if code starts with 1 and qty is kg ID should be 1
if code starts with 1 and qty is no ID should be 2

Thanks in advance

@Shriharsha_H_N,

Where you want to modify/write like that?

Fine
hope this steps would help you resolve this
–use a excel application scope and pass the file pathas input
–inside the scope use a READ range activty and get the output with a variable of type datatable namedd dt
–now use a for each row loop and pass the input as dt
–inside the loop use a assign activity
row(2) = if(row(0).ToString.StartsWith(β€œ2”),row(2) = β€œ100”, IF(row(0).ToString.StartsWith(β€œ1”) and row(0).ToString.Equals(β€œkg”),row(2) = β€œ1”,row(2) = β€œ2”),string.empty)

Cheers @Shriharsha_H_N

1 Like

@sarathi125 in the write line/message box

we can use the above expression in side the for each row loop within writeline activity
Cheers @Shriharsha_H_N

1 Like

image

just follow the same for the rest of the conditions.

@Palaniyappan its throwing a error please look into the screenshot
image

remove these row(4) = and keep just the values like β€œ100” β€œ1” β€œ2”
as we are using aassign activity here
image

Cheers @Shriharsha_H_N

@Palaniyappan

1 Like

the expression will be like this
if(row(0).ToString.StartsWith(β€œ2”),β€œ100”, IF(row(0).ToString.StartsWith(β€œ1”) AND row(0).ToString.ToUpper.Equals(β€œKG”),β€œ1”,β€œ2”),string.empty)

Cheers @Shriharsha_H_N

No same error

1 Like

aah got it
remove the string.empty
if(row(0).ToString.StartsWith(β€œ2”),β€œ100”, IF(row(0).ToString.StartsWith(β€œ1”) AND row(0).ToString.ToUpper.Equals(β€œKG”),β€œ1”,β€œ2”))

sorry for that
Cheers @Shriharsha_H_N

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