How To Use IF in Assign in Uipath

If(
1 <= Now.Month And Now.Month <= 3,
“12”,
If(
4 <= Now.Month And Now.Month <= 6,
“3”,
If(
7 <= Now.Month And Now.Month <= 9,
“6”,
If(
10 <= Now.Month And Now.Month <= 12,
“9”
)
)
)
)

Hey @minth08 ,
Try like this

OutputString= if(1<= Now.Month And Now.Month <= 3,"12","")

image

Regards,

1 Like

Hi @minth08

Welcome to UiPath community

How about this expression?

If(1<=Now.Month And Now.Month<=3,"12",if(4<=Now.Month And Now.Month<=6,"3",if(7<=Now.Month and Now.Month<=9,"6",if(10<=Now.Month And Now.Month<=12,"9","Need add else cases here"))))

Syntax:

If(condition, true-part, false-part)

Check out this link

Regards
Gokul

2 Likes

HI,

In this case, it’s unnecessary to use if as the following, for example.

dict = New Dictionary(Of Int32, String)From{{1,"12"},{2,"12"},{3,"12"},{4,"3"},{5,"3"},{6,"3"},{7,"6"},{8,"6"},{9,"6"},{10,"9"},{11,"9"},{12,"9"}}

Then

strvar = dict(Now.Month)

note: dict is Dictionary<int32,String> type

Regards,

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