How to compare two variables and assign pre defined value?

I have two variables and need to assign value to Variable called Date.

1). LastPrice : 100.50
2). NewPrice : 100.70

3). Date : ?

I want to apply logic like:

If there is a price change than take Date: 08/31/2024 (pre-defined date).
OR
If there is no price change than take Date: 09/01/2023 (pre-defined date).

How can I apply these logic? any help is appreciated.

@mavsp8

Try this

If(lastprice.equals(newprice),laterdate,newdate)

Cheers

Hi

you can put directly into assign activity:

date = if(condition, true value, false value), so

date = if(LastPrice <> NewPrice, date 08/31/2024, 09/01/2023)

Just keep in mind the type of variables

Hi @mavsp8

We can use Ternary operator

The general syntax of the Ternary operator in VB.NET.

If(question, expression1, expression2)
Here question(?) is the condition if condition is true, then expression1 will be execute otherwise expression2 will be execute.

Ex:
If(i > j, i, j)

Hope this will be useful. Thank you

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