Set in_Transactionitem String to 0

Hello everyone,

I’m attempting to change the value of 18 items in the “in_Transaction” variable to 0. This change is necessary when the string in the “BAS04, BAS05, BAS06, BAS11 etc.” field of the “in_TransactionItem” variable equals "€ - ". The reason for this change is because the current expression, which converts the value of the “BAS04” field to a numeric value, cannot handle the "€ - " string. My current expression that throws an error:

If(in_TransactionItem.SpecificContent(“BAS04”).ToString.Trim.Equals(" - “), “0”, CDbl(in_TransactionItem.SpecificContent(“BAS04”).ToString.Replace(“€”,”").Trim).ToString(“N2”, system.Globalization.CultureInfo.CreateSpecificCulture(“de-DE”)))

Thanks in adance,
Stijn

Try this instead

If(in_TransactionItem.SpecificContent(“BAS04”).ToString.Trim.Equals(“€ -“), “0”, CDbl(in_TransactionItem.SpecificContent(“BAS04”).ToString.Replace(“€”,””).Trim).ToString(“N2”, system.Globalization.CultureInfo.CreateSpecificCulture(“de-DE”)))

@sven.wullum1
Hey Sven,

Thank you for the fast reaction. It still gives me an exception.

Hi @uiStijn ,

Are you trying to change the values in the Queue Data ? Or just the Transaction Item that you get ?

I believe we will not be able to modify the values in the Queue Data once posted/added. You could check the below post on the discussion on the same.

Also, Let us know what is present in the Left Hand Side of the Assign statement.

Hey Superman,

I’m trying to change the in_Transactionitem after i get it out of the Queue.
Current multiple assign situation:

@uiStijn ,

Could you try using that Assign Expression in a Normal Assign activity and check if it gives the same error or a different error ?

1 Like

Hey Superman, i changed the expression from String.equal to String.replace and got it to work:

CDbl(in_TransactionItem.SpecificContent(“BAS04”).ToString().Replace(“€ -”, “0”).Replace(“€”,“”).Trim()).ToString(“N2”, System.Globalization.CultureInfo.CreateSpecificCulture(“de-DE”))

2 Likes

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