Is there a Contains function in SAS Hive (Hadoop)? - hadoop

I'm needing help again
Is there an equivalent to the Contains function in SAS Hadoop (explicit SQL Pass through) ?
E.g. an alternative version to:
WHEN a.DESCRIPTION NOT CONTAINS "XXX"
I attempted using:
When (array_contains(a.DESCRIPTION ,'XXX') = FALSE)
But that does not work.
Any help most welcome!

Thanks Kiran for suggesting the instr function.... looks like it does what I needed
So I used to get what I wanted:
When instr(a.DESCRIPTION, 'XXX') = 0 Then 1
Mayank.... Thanks for your suggestion, I'll investigate this function later on

You can probably use rlike(regular_expression).
WHERE some_col RLIKE '*abc*|*pqr*|*xyz*'
For negative results, put a NOT before RLIKE.
Let me know if this works.

Related

Convert the total amount in words

I'm converting my total amount into words using bi publisher. Btw, the amount is base on the data from the data set. Can someone help me what to do? Thanks
<?xdofx:to_check_number,sum(COLUMN_NAME, ‘EUR’, ‘CASE_UPPER’, ‘DECIMAL_STYLE_WORDS’)?>
I expect the output to be in words but the actual ouput is blank.
Use the function xdoxslt:toCheckNumber
Like this:
<?xdoxslt:toCheckNumber($_XDOLOCALE, sum(COLUMN_NAME), ‘EUR’, ‘CASE_UPPER’, ‘DECIMAL_STYLE_WORDS’)?>
For a detailed explanation, check this page. But bear in mind, this is an undocumented function.
In E-Business Suite r12, the XML file from the "out of the box" payments module has amount in text: OutboundPaymentInstruction/OutboundPayment/PaymentAmountText
<?xdofx:to_check_number(sum(COLUMN_NAME), 'EUR', 'CASE_UPPER', 'DECIMAL_STYLE_WORDS')?>
should work with fixed quotes and converted part ,sum(COLUMN_NAME,... into(sum(COLUMN_NAME),....
You can try this one which is working for my case.
<?xdoxslt:toWordsAmt(2300)?>
CASE_INIT_CAP

AX 2012 Database - BaseEnum to String

I am trying to Code a "while select" Statement.
I have a table "CarBrandTable" with two fields:
CarBrandId and Countries.
CarBrandId is a String.
Countries is a Base Enum.
Now I want to get the Data, by asking with a select Statement.
When I want to retrieve the Data by saying info(carBrandTable.countries);
The Compiler says... "Argument 'txt' is incompatible with the required type"
I know that my baseenum is not a string and that I hvae to somehow convert it.
But I have Trouble in doing so.
Does anybody have a tip for me ?
Thanks in advance
Rephrase the info like this:
info(strFmt('%1', carBrandTable.countries));
Other way is enum2str function.
info(enum2str(carBrandTable.countries));

How do I copy large ranges between workbooks efficiently?

i'm writing a copy paste function for a fairly large dataset to be copied from one workbook to a specific sheet in another. I have written the bellow code, in the hope that it will copy paste as efficiently as possible, however during debugging the code was shown not to be working at all, it doesnt copy or paste anything and I dont understand why, does anyone have any ideas / solutions? thanks in advance
Windows("TempResults.xlsm").Activate
numofrows = ActiveSheet.UsedRange.Rows.Count
Workbooks("TempResults.xlsm").Sheets("Sheet1").Range("A2", "AE" & CStr(numofrows)).Copy Destination:=Workbooks("Excel Results Extractor V2.xlsm").Sheets("Gate_Results").Range("A1").End(xlDown).Offset(1, 0)
I guess this is what you want
Windows("TempResults.xlsm").Activate
numofrows = ActiveSheet.UsedRange.Rows.Count
Workbooks("TempResults.xlsm").Sheets("Sheet1").Range("A2", "AE" & CStr(numofrows)).Copy Destination:=Workbooks("Excel Results Extractor V2.xlsm").Sheets("Gate_Results").Range("A1")
Regarding the efficiency concern expressed in your question: you can try an alternative approach, like the following:
Workbooks("Excel Results Extractor V2.xlsm").Sheets("Gate_Results").Range("A1").Value = Workbooks("TempResults.xlsm").Sheets("Sheet1").Range("A1").Value
Try to see how it works, then modify the range correspondingly to your case.
Hope this will help. Regards,

Regex array (["number", "number",...])

Can you help me with expression for array: ["232","2323","233"]
I try this: /^\[("\d{1,7}")|(,"\d{1,7}")\]$/
But this expression is not working properly.
I use ruby(rails).
This would validate the array structure well, blocking an entry like [,"123"]
^\[(("\d{1,7}")(,"\d{1,7}")*)?\]$
You may try this ( though it may allow leading ,):
^\[(,?"\d{1,7}")*]$
Try this: /^\[("\d{1,7}")(, ?"\d{1,7}")*\]$/

Descendent-or-self in InfoPath

I want to use XPath code in an InfoPath form to sum the data in field12 when field11 is equal to IT. I tried using the following code, but it doesn't work.
number(sum(/descendant-or-self::node()/my:group12[my:field11 = "IT;"]/my:field12))
I suspect this has to do with the multilayering of groups, as shown below. Does anyone know the code that would allow me to get to the data in group12? Thanks in advance for your help.
myfields>group9>group10>group11>group12>field11 field12
Genipro
Looks like:
number(sum(/descendant-or-self::my:group12[my:field11 = 'IT;']/my:field12))
could be right.
decendant-or-self should not be necissary in this case (unless you need the expression to work even if group12 is moved).
This should work fine:
sum(/my:myfields/my:group9/my:group10/my:group11/my:group12[contains(my:field11,'IT')]/my:field12)
It doesn't matter if any of the other groups are repeating either. All group12's will be checked.

Resources