Categories
Using a locale variable in OAP template

Hi all,
Is it possible to define a locale as a variable in a RTF template loaded in OAP ?
I have 1 invoice template that can have different formatting based on the customer locale. Do we need to define 2 separate templates or could it be the same template accepting different locales to format the fields accordingly ? For instance formatting the amount fields based on the locale ?
The locale is received in the xml file loaded into OAP
Some links on how to define that would be helpful as well.
Thanks for your support, jef
Best Answer
-
Hello Jef,
The decimal and grouping separator symbols used, are determined at runtime based on template locale. And this is a fixed value that you can't change based on Data. It is determined when you create the Template, thus having a Template for each locale is necessary, specially for currencies.Please see on Formatting Numbers and Currencies:
And see about Localization for Reports:
1
Answers
-
Hello User_BPRZY,
I recommend using Bursting and separate Templates.
You can control which Template is used when doing Bursting, by using a CASE Clause.
Your Bursting Query needs the CASE Clause in the TEMPLATE, like this example:select distinct
DEPARTMENT_ID as "KEY",
CASE WHEN DEPARTMENT_ID = 50 THEN 'Dep 50' ELSE 'Report Emp' TEMPLATE,
'en' LOCALE,
'xlsx' OUTPUT_FORMAT,
DEPARTMENT_ID || 'Employees Detail.xlsx' OUTPUT_NAME,
'EMAIL' DEL_CHANNEL,
'name@oracle.com' PARAMETER1,
'name@oracle.com' PARAMETER2,
'name@oracle.com' PARAMETER3,
'Test Layouts' PARAMETER4,
'Hi'||FIRST_NAME||':'|| 'Please find your report attached.' PARAMETER5,
'true' PARAMETER6,
'donotreply@oracle.com' PARAMETER7
from "VDB01"."EMPLOYEES" "EMPLOYEES"Documentation and more details on how to use Bursting:
https://docs.oracle.com/en/middleware/bi/analytics-server/design-publish/add-bursting-definitions.html#GUID-A926D588-426F-47C7-8A9A-B0A7959C5814Jorge
1 -
Hi Jorge,
Thanks for your guidelines. I understand that based on the locale received in the XML we can select the template to use using BIP bursting function with a case clause.
So the locale is at the template level. My question is also if we could define within the same template (let's say we have a template with a default locale en_US for instance) fields formatted based on a locale variable set into the template. Something like: CUSTOMER_LOCALE is the one received from the xml to display the invoice in French for instance
<?xdoxslt:set_variable('locale', CUSTOMER_LOCALE)?><!-- Later used as -->
<?xdoxslt:format_number(AMOUNT, '#,##0.00', xdoxslt:get_variable('locale'))?>
Could that work ? Ok we would need may be to test may be. That would prevent duplicating the templates for each locale.
Thanks again, jef
0