Business Objects - New 'InList' Variable (Help Needed) - business-intelligence

I'm using SAP BusinessObjects Web Intelligence 14.0.6, and am having trouble figuring out how to create a InList variable, that will replace multiple values of one column, with replacement values I want it to display. I remember in old BO WebInel XI, there was a feature to keep adding a level to the variable. I don't see that in this version maybe
What I'm trying to do, is create a new variable called 'Region' that will replace certain values in a column called 'Site'. Example:
SITE: Hong Kong, Bangkok, Hanoi, California, Miami, Berlin, Paris
What I want is to have the variable called Region, replace these values with selected values in Example:
REGION: AP, AP, AP, NA, NA, EU, EU
Its been years since I used BO, so I'm very rusty at this part. I know it can be done, cause I done it before, but this new version I'm a little clueless.

The formula you want to use is:
=If [Site] InList('Hong Kong', 'Bangkok', 'Hanoi') Then 'AP'
ElseIf [Site] InList('California', 'Miami') Then 'NA'
ElseIf [Site] InList('Berlin', 'Paris') Then 'EU'
If [Site] contains a value different from the ones you mentioned, no value will be returned (NULL).
If you append the following to the formula:
Else 'Unknown'
... then Unknown will be shown if it the [Site]'s value isn't in the list.
If you want to find out more information regarding the formula's available, have a look at the manual Using Functions, Formulas and Calculations in SAP BusinessObjects Web Intelligence 4.0 SP5.

I was trying to use InList and the above formula does not work. I changed the single quote to double quote and comma to semicolon ( as mentioned here https://bi.emea.nsn-net.net/BOE/portal/123/AnalyticalReporting/help/en/frameset.htm?471c17396e041014910aba7db0e91070.html)
=If [Site] InList("Hong Kong"; "Bangkok"; "Hanoi") Then "AP"
ElseIf [Site] InList("California" ; "Miami") Then "NA"
ElseIf [Site] InList("Berlin", "Paris") Then "EU"

Related

Syntax for Sequential Variable Names

I am struggling to compile my large dataset and am assuming syntax commands are the answer, however, I am not skilled at all with syntax. My questions are specific to what syntax commands (or other methods) I should use to create hundreds/thousands of new variable names so I do not need to do it manually.
I am working with a dataset involving intimate partner homicides and domestic violence services utilization among victims from 2012-2021 (10 years), examined monthly (120 months). Across that timeframe, I have a three variable name set (REC [number of clients who received services], CALL [number of calls for services], HOUR [number of hours advocates/employees spent providing services]) that needs to be repeated monthly Jan-Dec across 10 years 2012-2021 and 39 separate services. See below:
MonthYear_REC_ServiceName
MonthYear_CALL_ServiceName
MonthYear_HOUR_ServiceName
"Month" in the above is Jan-Dec (01-12), "Year" is 2012-2021 (12-21), and "ServiceName" would be replaced with 39 different services. As an example for the year 2017 and "Shelter" services:
0117_REC_Shelter
0117_CALL_Shelter
0117_HOUR_Shelter
0217_REC_Shelter
0217_CALL_Shelter
0217_HOUR_Shelter
0317_REC_Shelter
0317_CALL_Shelter
0317_HOUR_Shelter
.....so on and so forth until December of 2017.
To further explain: This sequential monthly order would need to be repeated for each year in the 2012-2021 timeframe for each of 39 services for which I have data. "Shelter" services are shown as an example above, but I also need the same set of variable names across 38 other service types such as group counseling, legal advocacy, economic assistance, etc.
My overall question is (sorry for the repetition)- What syntax commands would I need to input to create this MASSIVE amount of variable names/variables? I hope this makes sense to everyone in the same way it makes sense to me! Sorry for the length and thank you in advance.
Best,
Shannon H.
Assuming what you want is to create an empty dataset with all the variable names you described, this will do it:
INPUT PROGRAM.
LOOP ind = 1 to (12*10*3*39).
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
EXECUTE.
do repeat vr=month year set service/vl=12 10 3 39.
compute vr=mod(ind,vl).
recode vr (0=vl).
compute ind=trunc((ind-1)/vl)+1.
end repeat.
compute year=year+11.
formats all (f2).
alter type month year (a2) set (a4).
compute month = char.lpad(ltrim(month), 2, "0").
recode set (" 1"="REC")(" 2"="CALL")(" 3"="HOUR").
* I suggest at this point you use "match files" to match the service numbers here with a list of service names.
* The following code creates fictitious service names instead to demonstrate how to use them.
string serviceName (a20) vrnm (a50).
compute serviceName=concat("service", char.lpad(ltrim(string(service, f2)), 2, "0") ).
* now to create the final variable names.
compute vrnm=concat(month, year, "_", set, "_", serviceNAme).
flip NEWNAMES = vrnm.
select if CASE_LBL="".
exe.

In Google Sheets, How do I sumif(s) over a comma separated list in string?

In our schools, we have books of the same title by the same author but different ISBN #s. I am working on an inventory list so that we can scan the different ISBNs and then find out what is on hand for a title.
Here is my working spreadsheet demo. The live version will be separated (columns A-D by data that comes in on another sheet (possibly by Google Forms) and a separate sheet (F-J) that does all the math. For convenience / testing, they are all on one sheet.
Essentially, in column F, I would like to sum all the quantities in A where the ISBN's in C match any of the values of G and place it in F.
The formula I am using in F doesn't seem to completely work:
=SUMIF(C:C,arrayformula(split(G2,",")),A:A)
It captures the first match but ignores / doesn't loop over the rest. I have looked at Sumifs and Match and I cannot seem to get any closer with the syntax. I would greatly appreciate if anyone can help me solve this dilemma.
Additionally, I know how to do this with a custom script but I need to avoid that as end users break things for one reason or another and I can't handle the debugging load the way this could possibly be deployed.
Thanks in advance for anyone willing to take a look at this!
~Allan
Try in F2
=sum(query(A:D,"select A where C matches '"& textjoin("|",,split(G2,",")) &"' ",0))
delete everything in F2:F & J2:J and use F2:
=INDEX(IF(G2:G="",,MMULT(IFERROR(VLOOKUP(SPLIT(G2:G, ","), {C:C, A:A}, 2, ), 0),
SEQUENCE(COLUMNS(SPLIT(G2:G, ",")), 1, 1, ))))
in J2 use:
=ARRAYFORMULA(IF(G2:G="",,F2:F*I2:I))

Sorting English Style dates

I have a macro which is sorting a group of columns in an ascending order using column A which has an English format date and time in it. Each selection of data in the sheet covers two days. That's fine and working OK until the month changes at which point 30/04/2014 is treated as a larger value than 01/05/2014. At that point the 01/05/2014 rows are put to the top and the 30/04/2014 are sorted to the bottom, the opposite of what i would want.
Here's the snippet of code that does the sorting.
With Range("AA1")
.Value = 1
.Copy
'Modified the value conversion section to avoid changing the date to an american format
With Range("B1:Z" & WriteToRow - 1)
.PasteSpecial Paste:=xlPasteValues, Operation:=xlMultiply
End With
With Range("A1:Z" & WriteToRow - 1)
.Sort key1:=Range("A2"), order1:=xlAscending, Header:=xlYes
.EntireColumn.AutoFit
End With
.Value = ""
Can anyone help with this? I have thought that i could add an IF statement to say if the first 2 characters of A2 are 01 then sort descending but then i would need another IF to say that if the first two characters are 02 sort again into ascending so that when the file is processing between the 1st and 2nd of each month the order is correct. It seemed a bit messy to me so i thought i'd see if someone much smarter than me had a cleaner solution.
Thanks, 7's
Even though the control panel is set to proper Locale or Language, the developer might be from a completely different location handling projects from different nation.
It is nice to read different views from all experts. To override OS or Excel Intelligence from determining the date format, it is better to format it by using "=Text" command.

To find a particular word written in a string type field in AX 2012?

Is it possible in AX 2012 to find a particular word/words written in a string type field in AX 2012 table or form.
e.g, I have a field named Memo in my table named test. In that field I have a written a text as:
Hello,
We need to confirm you that your < mobileNumber > is successfully attached with your account no. < Account >.
Now, I need to find all texts written inside tags "<" and ">".
Furthermore I require to replace these texts according to my need.
Please tell if its possible in AX 2012 or if there is any other option that I can opt to fulfill my need.
You can find every occurence of "<" and ">" using the strScan function
http://msdn.microsoft.com/en-US/library/aa866529(v=ax.50).aspx
Use that to find the location of the "<"s and matching ">"
Use SubStr http://msdn.microsoft.com/en-US/library/aa677836(v=ax.50).aspx to find what is between "<" and ">", and apply your replacement based on that (using strPoke http://msdn.microsoft.com/en-US/library/aa850123(v=ax.50).aspx)
A useful AX2009 string class that utiliseses these methods and that may be of some help can be found here
http://axgeek.blogspot.co.uk/2010/04/string-function-class.html , it should not take much effort to convert to 2012.
Of particular interest to you is the replace method.
However it may be simpler to have the memo as "Hello, We need to confirm you that your %1 is successfully attached with your account no. %2.", and to insert the values using strFmt
http://www.axaptapedia.com/index.php?title=StrFmt
Of course the .Net String.Replace method is also available.
see http://msdn.microsoft.com/en-us/library/cc584291.aspx and http://msdn.microsoft.com/en-us/library/system.string.replace.aspx

iphone's phone number splitting algorithm?

iPhone has a pretty good telephone number splitting function, for example:
Singapore mobile: +65 9852 4135
Singapore resident line: +65 6325 6524
China mobile: +86 135-6952-3685
China resident line: +86 10-65236528
HongKong: +886 956-238-82
USA: +1 (732) 865-3286
Notice the nice features here:
- the splitting of country code, area code, and the rest is automatic;
- the delimiter is also nicely adopted to different countries, e.g. "()", "-" and space.
Note the parsing logic is doable to me, however, I don't know where to get the knowledge of most countries' telephone number format.
where could i found such knowledge, or an open source code that implemented it?
You can get similar functionality with the libphonenumber code library.
Interestingly enough, you cannot use an NSNumberFormatter for this, but you can write your own custom class for it. Just create a new class, set properties such as countryCode, areaCode and number, and then create a method that formats the number based on the countryCode.
Here's a great example: http://the-lost-beauty.blogspot.com/2010/01/locale-sensitive-phone-number.html
As an aside: a friend told me about a gigantic regular expression he had to maintain that could pick telephone numbers out of intercepted communications from hundreds of countries around the world. It was very non-trivial.
Thankfully your problem is easier, as you can just have a table with the per-country formats:
format[usa] = "+d (ddd) ddd-dddd";
format[hk] = "+ddd ddd-ddd-dd";
format[china_mobile] = "+dd ddd-dddd-dddd";
...
Then when you're printing, you simply output one digit from the phone number string in each d spot as needed. This assumes you know the country, which is a safe enough assumption for telephone devices -- pick "default" formats for the few surrounding countries.
Since some countries have different formats with different lengths you might need to store your table with additional information:
format[germany][10] = "..."
format[germany][11] = "....."

Resources