[SOLVED] Azure Synapse convert value in row

Issue

This Content is from Stack Overflow. Question asked by Frank Lohfeld

i will in an Azure Synapse Dataflow, for every row that field value in Column “Name” Starts with “F-” synapse should change the value from Column “Price” to a absolute Value of the price.
Which Mapping data flow transformation can i use and which expression i must use?
I have tryed the “alter Row” transformation but i couldn’t get the expression done.

SORRY I’m a absolut beginner

in Example
Original:
| Name | Price |
|:—- |——:|
| P-12344 | -21354,45|
| S-12335 | 12543,45|
| F-13564 | 54,45|
| F-112344 | -1254,45|

Output

NamePrice
P-12344-21354,45
S-1233512543,45
F-1356454,45
F-1123441254,45

THANKS IN ADVANCED



Solution

You can use derived column transformation and abs() function in data flow.

Please go through the sample demonstration below:

Source data:

I have given String type to Name column and integer type to Price column in the projection of the source.

enter image description here

Derived column transformation:

Give the below expression

iif(startsWith(Name,"F"),abs(Price),Price)

enter image description here

Result in Data preview:

enter image description here

You can give the same source in the sink.


This Question was asked in StackOverflow by Frank Lohfeld and Answered by Rakesh Govindula It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?