gorby
(gorby)
1
UiPath Studio 2023.10.0 EnterPrise Licenseの初心者ユーザです。
3桁と2桁の整数値が並んでいます。
(イメージ)
100
90
20
80
600
70
50
40
・
・
下3桁と2桁の数値を組み合わせて2桁の数値を作成し、マイナス3した数値を作成したいが構文はどうなりますでしょうか。
例えば、100の場合は、10-3=7、70の場合は、07-3=4となります。
なお、最も小さい数は40のため、結果はマイナスにはなりません。
Anil_G
(Anil Gorthi)
2
@gorby
You can use like this inside loop…
Say you arelooping on datatable with all these number
Then inside loop
Requiredvalue = Cont(currentRow("Column").ToString.PadLeft(3,CChar("0")).SubString(0,2)) - 3
Cheers
gorby
(gorby)
3
Thank you for your reply!
Are there any means without using datatable?
Anil_G
(Anil Gorthi)
4
@gorby
Then formula works in anyway…without datatable also…
The idea is to just send each number once per iteration how ever it is…you can split the value and loop also
Cheers
gorby
(gorby)
5
Hi On my second thought, I noticed I can achieve my goal using simple Else If activity…
Pls let me know your comment.
Input data
100
90
20
80
600
70
50
40
・
・
Say, Input data is int_input, result is int_result,
If int_input.ToString.Length = 3
str_checkA= Left(int_input.ToString,2)
int_result = Cint(str_checkA)-3
Else If
str_checkA= "0" + Left(int_input.ToString,1)
int_result = Cint(str_checkA)-3
End If
RajKumar_DC
(RajKumar Durai)
6
Hi @gorby ,
You can use the following syntax:
Conversion. ToInt32 (item. ToString. Substring (item. ToString. Length -2.1))- 3
This extracts the last two digits from each number and converts them to integers, from which 3 is subtracted and the result is returned.
Thanks,
Anil_G
(Anil Gorthi)
7
@gorby
You can do that also…
But I dont understand why do you want to attach a 0 at start as even if you attach…once converted to integer it will be ignored
Cheers
gorby
(gorby)
8
You may understand my intention if you read back my question at the top of this thread.
1 Like
Anil_G
(Anil Gorthi)
9
@gorby
07-3 or 7-3 gives the same result
cheers
gorby
(gorby)
10
You may understand my intention if you read back my question at the top of this thread.
Anil_G
(Anil Gorthi)
11
@gorby
I dont want to reiterate…but fine you got the answer Happy Automation
cheers
system
(system)
Closed
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.