Expression to replicate Aggregator - informatica

I need to replicate below piece of sql expression in informatica where COLUMN1 is Decimal(25,6) :
replace(round(coalesce(trim(L '0' FROM COLUMN1),0),0),'.000000','')
I tried using the below in my aggregator expression :
IIF(ISNULL(COLUMN1),0,(ROUND(LTRIM(COLUMN1,0),0)))
encountered the below error when validated the same:
[ROUND]: operand cannot be converted to a number
Please help me fix this issue

It's failing coz you are applying a string function LTRIM to COLUMN1 implicitly converting it to a string and then you are applying ROUND to a string.
A way to solve this would be to just use ROUND. Since COLUMN1 is a decimal, you don't need to strip the left zeroes as they won't be there.

Please use this functions it will work.
v_port-- IIF(ISNULL(COLUMN1),'0',LTRIM(COLUMN1,0))
v_port1(datatype(decimal)--- TO_DECIMAL(v_port)
o_port ROUND(v_port1,2)--(how many character decimal like 1 or 2 just i mentation 2)
it will work.

Related

Create an IsNumeric condition in where clause (SQL)

I have a text field called Emp_number in the format of A1234567. I want to get the right 7 characters and then cast those 7 characters to Int.
However I sometimes get "dirty" data eg F1234G99 then I don't want to cast it.
How can I write my where clause to do this in SQL? I'm a beginner so please be very specific.
Thanks.

How to filter by Regex in LibreOffice?

I've got this string:
{"success":true,"lowest_price":"1,49€","volume":"1,132","median_price":"1,49€"}
Now I want the value for median_price being displayed in a cell. HHow can I achive this with Regex?
With regex101.com I've came to this solution:
(?<=median_price":")\d{0,4},\d{2}€
But this one does not seem to be working in LibreOffice calc.
I'd advise to discard the Euro-symbol at first since you'd probably want to retrieve a value to calculate with, a numeric value. Therefor try:
Formula in B1:
=--REGEX(A1;".*median_price"":""(\d+(?:,\d+)?)€.*";"$1")
The double unary will transform the result from the 1st capture group into a number. I then went ahead and formatted the cell to display currency (Ctrl+Shift+4).
Note: I went with a slightly different regular pattern. But go with whatever works for your data I supppose.

REGEXMATCH and MATCH don't work when a cell contains a number

I am trying to use formulas to find a row in my google spreadsheet document, however I have got a weird problem.
I am not able to find values when a cell contains a number (without any other characters).
Consider the following case
I have got two values
A1 - 32323232323
A2 - 323-23232-323
When I use the following formula
=FILTER(A:E,REGEXMATCH(B:B,"323-23232-323"))
It works fine, it successfully finds A2 value, however when I try to use the following formula
=FILTER(A:E,REGEXMATCH(B:B,"32323232323"))
It doesn't match any row, and I also tried the following formula
ADDRESS(MATCH("32323232323",B:B,0),1)
It doesn't work either, it only works when I remove quotes like that
ADDRESS(MATCH(32323232323,B:B,0),1)
But this doesn't work with REGEXMATCH.
Is there any way I can match numbers using a regex expression (exact number, without wildcards) ?
Thanks
=FILTER(A:A,REGEXMATCH(REGEXREPLACE(TO_TEXT(A:A),"-",""), "32323232323"))
to get both 323-23232-323 and 32323232323.
=FILTER(A:E,REGEXMATCH(TO_TEXT(B:B),"32323232323"))
to get number 32323232323.
Notes:
Converting to_text is a key here.
Change columns to yours.

Oracle to Vertica reqexp_replace - keep just numbers and alphas

I am using the following expression in Oracle and it performs as expected returning only alpha numeric characters. When I try to use it in Vertica I get null. Any wisdom out there?
trim(upper(regexp_replace(PATIENT_CITY,'[^[:alpha:]^[:alnum:]'' '']', NULL))),
Why are you setting the fourth parameter (position) to NULL?
The following statement works well:
SELECT regexp_replace('451 #$%!^ 657asdsg', '[^[:alpha:][:alnum:]'' '']')
Note the second caret ("^") should not be there (even for Oracle).

Check if cell contains numbers in Google Spreadsheet using RegExMatch

I want to check if specific cell contain only numbers.
I know I should use RegExMatch but I get an error.
This is what I wrote : =if(RegExMatch(H2,[0-9]),"a","b")
I want it to say : write 'a' if H2 contains only numbers, 'b' otherwise.
Thank you
Try this:
=IF(ISNUMBER(H2,"A","B"))
or
=if(isna(REGEXEXTRACT(text(H2,"#"),"\d+")),"b","a")
One reason your match isn't working also - is that it in interpreting your numbers as text. the is number function is a bit more consistent, but if you really need to use regex, then you can see in the second formula where im making sure the that source text is matching against a string.
Your formula is right, simple you forget the double quotes at regexmatch function's regular_expression .
This is the right formula: =if(RegExMatch(B20,"[0-9]"),"a","b")
=REGEXREPLACE(“text”,”regex”,”replacement”)
It spits out the entire content but with the regular expression matched content replaced. =REGEXREPLACE(A2,[0-9],"a")
=REGEXREPLACE(A2,![0-9],"b")//not sure about not sign.
will fill a cell with the same text as A2, but with the 0-9 becoming an a!