- Posts: 6
If-then-else for another field
- Richard Barnett
- Topic Author
- Offline
- User
Less
More
7 years 4 weeks ago #3393
by Richard Barnett
If-then-else for another field - Post(3393) was created by Richard Barnett
Hi.
I am having trouble finding an example of an if-then-else where the if query relates to a different field. So my data is something like this
SKU Brand Price
123 Brother $100
124 Epson $110
125 Epson $120
126 HP $130
So I want to calculate
IF Brand = Epson then Multiply Price by .99 and
IF Brand = HP then Multiply Price by .98
else keep the same price.
Can you help with this?
Thank you
I am having trouble finding an example of an if-then-else where the if query relates to a different field. So my data is something like this
SKU Brand Price
123 Brother $100
124 Epson $110
125 Epson $120
126 HP $130
So I want to calculate
IF Brand = Epson then Multiply Price by .99 and
IF Brand = HP then Multiply Price by .98
else keep the same price.
Can you help with this?
Thank you
Please Log in or Create an account to join the conversation.
- FlowHeater-Team
- Offline
- Admin
7 years 4 weeks ago #3394
by FlowHeater-Team
Best wishes
Robert Stark
Replied by FlowHeater-Team on topic If-then-else for another field - Post(3394)
Hi Richard,
You have to use a Condition chain. The First IF-THEN-ELSE Condition just have the rule “Brand” = HP. Wether is YES the calculatet values goes out in case of NO the original value are the result. The second IF-THEN-ELSE Condition use the rule “Brand” = Epson. In case of yes the price will be calculate in case of NO the value form the first condition will be used. That´s all.
Attached you´ll find an example how it´s work. In the example I also used the .NET Script Heater and a little script.
Here you´ll find two more detailed examples:
Simple If-Then-Else example
Complex If-Then-ElseIf example
You have to use a Condition chain. The First IF-THEN-ELSE Condition just have the rule “Brand” = HP. Wether is YES the calculatet values goes out in case of NO the original value are the result. The second IF-THEN-ELSE Condition use the rule “Brand” = Epson. In case of yes the price will be calculate in case of NO the value form the first condition will be used. That´s all.
Attached you´ll find an example how it´s work. In the example I also used the .NET Script Heater and a little script.
Here you´ll find two more detailed examples:
Simple If-Then-Else example
Complex If-Then-ElseIf example
Best wishes
Robert Stark
Attachments:
Please Log in or Create an account to join the conversation.
- Richard Barnett
- Topic Author
- Offline
- User
Less
More
- Posts: 6
7 years 3 weeks ago #3395
by Richard Barnett
Replied by Richard Barnett on topic If-then-else for another field - Post(3395)
Hi there.
Thanks very much for that. Once I set up the New Price field it all worked great.
The .NET script version works fine too - this .NET version is easy to add other brands if I wish.
Thanks very much for that. Once I set up the New Price field it all worked great.
The .NET script version works fine too - this .NET version is easy to add other brands if I wish.
Please Log in or Create an account to join the conversation.
Time to create page: 0.266 seconds