How to convert Price number

Hi,
i have a problem, with convert price.
I have to compare two amounts, written in two different ways.
ex:
first data captured like this: “559,260.00 EUR”
second data captured like this:“559.260”

ex 2:
first data captured like this: “3,500.00 EUR”
second data captured like this: “3.500”

I have to compare the two amounts, and they must be identical
because they are different only for different formatting.

Can help me?
thanks.

Hi @AaronMark,

You can use regular expressions for this. Below snippet will replace all the characters to empty except interger.

System.Text.RegularExpressions.Regex.Replace(val, “[^0-9]”, “”)

Edit: val.Replace(",", “”) - If you want to remove only comma from string.

2 Likes

@AaronMark
You can Parse it with taking control over numberformat info / Culture Settings (lets ignore EUR so far)
first Price is in a form of default format
Second Price is common in Germany, France…

Have a look here


grafik
grafik

It is suggested to parse it into Digit related Datatypes to avoid sideeffects and to be prepared on computations e.g greater / smaller checks, additions …

1 Like

@Praveen_Erakkingal Then… but, not work.
image
The first two lines, it’s how the data is collected.
Third and fourth, after replace.
Unfortunately, by comparison, they are incorrect, but the amount is the same.
The rule, however, should also work for those amounts, which also have decimals.

@ppr I try…

@AaronMark - if you are converting values and removing ,/. with string replacement/regex/split/etc - will lead to a mismatch/incorrect values.

To convert currency formatting to integer/double - go though below link which help you a easy way -
https://docs.microsoft.com/pt-br/dotnet/standard/base-types/standard-numeric-format-strings?redirectedfrom=MSDN#CFormatString

Thanks for the help, but I don’t know how to apply the tips.
I understood that the correct way is to convert the collected data, referring to the library: System.Globalization.
But I don’t know how to write the variable to convert the collected data.
I’m getting an error.

ExtractData.xlsx (26,8 KB)

I try to integrate with files.
My work must collect data from two sites, (Site1 and ServiceNow)
and compare the prices, and the lines entered.
If the same, proceed with other operations.
Otherwise, stop.

In sheet1, I collected data from site1, (page1 - Numer order)
in sheet2, I collected data from site1, (page2 - other data, including amount: Cell A11)

In sheet3, an overall extraction from ServiceNow.

I have to look for the PORDER (sheet1, B2) in the list in sheet3,
and if the amounts are equal, proceed.

The two amounts, however, are written in two different formats.
I am very inexperienced. Excuse me.

@AaronMark
Can you have a look to my screenshots (watch, Variable)

  • create the variables
  • do readin both excels
  • in e.g. an if activity you can compaire both type of amounts by using the conversion functions as the syntax is in watch screenshot.

also you can try with a test sequence create two strings with amount within the 2 type of valueformats
do within an if a compair on the two converted boolean using the conversion functions
message Boxing true, false and explore the topic practical

Incase you get issues within your modelling we are here to help and can also have a look on your XAML

My full flow is this.
I’m not sure I am doing well, having little experience.
TestSNv0.xaml (87,8 KB)

Description:
Open Site 1, “page 1” and collect ID’s (extract-data-table)
For each Row, of the Site1, go into detail and collect some specific data.
Then,
Go to Site2: (servicenow), and from the list, search Site ID collect in Site1,
and compare if the data is equal.

ExtractData.xlsx (26,8 KB)
In this excel i write all data.
Sheet1: Page1 , site1
Sheet2: Page2 site1
Sheet3: table scraping on ServiceNow.

I have to look in the list of sheet3,
Porder collected on Page1, site1,
and verify that:
PO_Line, and Price are equal.

If they match, I have to perform other operations, not yet present.
I don’t know exactly if the flow is correct.
Maybe there is a better method.
And then, the problem is the formatting of the price…

ex: my ID Number in list is: 0410008151
image
In sheet2, i get: PoLine value (1)
and Sub.Amt (3,500.00)
image

then, I have to check if in sheet3,
amounts and lines, match.
image
Writing takes place on two lines.
One is the total, for POrder who have multiple lines.
The second line indicates the amount for each line.

It is too complicated for me.
And a first obstacle, it is certainly the formatting of the price.
Can anyone help me?

@AaronMark
Have a look and play with this demo
AronMark.xaml (6.5 KB)

it seems to work.
WoW!
… any ideas on how to organize the flow? :slight_smile:
I am very poor. I know.

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