Business Objects User Input with Prompts - business-intelligence

I am trying to create the following logic on a Business Intelligence Report (Business Objects):
The requirement is an Initial Prompt in which a user can enter "A" or "M" which "A" stands for Auto and "M" for manual. Based on the user Input,
if "A" is chosen the report will refresh with current year.
If "M" is chosen then the report will provide another Prompt asking the user to select which year he wants.
What i have tried so far is the Cascade Prompt, but in the current situation is not feasible.
Is it posible to implement this kind of logic in SAP BO Report Or create a prompt that is not mapped to a dimension Object?
Just to mention i am using Universe Design Tool version 4.2
Thanks

You can certainly achieve your objective by creating a filter with prompt in the Business Layer of your universe, but it is going to function a little differently that you are describing. The idea is you prompt for the number of years to go back. So "0" would be the current year, "-1" would be the previous year, "1" would be the next year, and so on.
This is SQL Server T-SQL syntax so you would need adjust the code to fit whatever database your universe is based upon if it is not SQL Server. Of course, you would need to replace my table and date column with yours.
CONVERT(DATE, DATEADD(YEAR, #Prompt('Number of
years:','N',,Mono,Free,Not_Persistent,,User:0), GETDATE())) = [Your
table and column goes here]
Does that work for you?

Related

Adf column filter: which format does ADF use to generate the where clause in the VO's query?

TLDR; is there a way to understand at runtime which format is ADF using for dates behind the scenes? In particular the format used to render dates in dynamically generated sql code?
In the Oracle ADF Application I'm working on there are several table filters (by that I mean the field over the column in which I can write text/number/dates to query the table).
Filtering this way, the framework modifies the query of the View Object, adding the appropriate where clause. On the page there's also a button "Select all" that allows me to select all the data that's rendered in the table (there is a selection checkbox).
In the specific case, the query from the VO is used to aim two different goals:
update the rendered data in the table
if I press the "select all" button a function in the backend database is called (callable statement calling the function), passing as a parameter the query.
The first task is successfully reached (as the table is visually updated), but we had an issue with the second one.
The backend function uses the query to select all the extracted data (as iterating in ADF with java would be too slow).
The problem is that the where clause isn't correctly generated for the backend database (which is also oracle).
Basically the generated WHERE clause (which was added to VO's query automatically by the framework) was
WHERE record_date = '2020-10-12'
which I had to change to
WHERE record_date = to_date('2020-10-12', 'YYYY-MM-DD')
in order to have it correctly executed by the Oracle Db.
So now it's working (yay), but my concern is: isn't it dangerous to assume the date format will be 'YYYY-MM-DD' on every application's instance?
I think this 'YYYY-MM-DD' is the format in which ADF is managing dates (as the value is written as '2020-10-12' in the query).
But is there a way to understand at runtime which format is ADF using for dates behind the scenes? Or does it always use 'YYYY-MM-DD', or am I completely off-road and the storage format is another and I should ask which format does it use to render dates? But dates on page are visually rendered in another way :/
Sorry for my lack of expertise and have a nice day!
Update
The value of the query field, which I'm getting by calling
this.getNamedWhereClauseParams().getAttribute('vc_temp_1');
is of class
oracle.jbo.domain.Date
and by printing it I obtain the date in format YYYY-MM-DD.
Would it be possible that the framework was simply using Date.toString?
This would raise another question: how can I be sure of the pattern used by Date.toString? The documentation isn't clear about it (and it says that it should be used only in development, so this is quite a remote scenario).
What you named 'Filter' is called 'Query by Example' or QBE in short. See the doc for more info.
You can change the query passed to the server using a bean method. Look at e.g. JDev 12.2.1.3: Multi select component table filter for a sample.
Using dates in ADF is always dependent on the current user's settings. If the user don'T use a specific locale the default is 'yyyy-mm-dd'. This can be changed at different points, starting by the entity objects, view objects a,d finally in the UI by using converters.
The best way to use dates depends on the use case.

How to make groups in an input and select a specific row in each of them in Talend?

I am working on a Talend transformation process (we are using Talend 6.4).
, and I don't know how to implement the current requirement.
I have an input consisting in :
Two columns that are my group keys (Account and Product), but are not unique (the same Account x Product couple can happen in multiple rows)
A criterion column (Contract end date), which will help me decide which row I want to keep for each group
Some "tail" data that need to be passed to the following step of the processing (the contract number)
The rule to implement is:
Keep only one record per group
The selected record must be one with no end date or, if all have end date, with the biggest end date
The selected record can be random in case there is a tie
See the transformation applying those rules on some dummy data:
I thought first to do the following:
sort by Account, Product, End_date (nulls first)
"select first" in each group
but I am not skilled enough to know whether the second transformation exists in Talend.
Regards,
Pierre
Very interesting Talend question.
You need to create something like this job.
here a link to the zip file to import in your Talend
The answer from #MBDIA seem to be working, however I would like to share what we did to fulfill our requirement.
See our Talend process here:
The first tMap (tMap_3) acts like a tReplicate and a tMap, and sends:
in the upper branch only the Account and Product references, that are then deduplicated by the tAggregateRow_1.
in the lower branch all data and computed fields that enables us to take care of the case where the date is missing (instead of defaulting to 31/12/9999, we compute a flag (0 or 1) that we use in the sort step afterwards).
In the second part of the process, we first apply the sort to the whole data on Account, Product, Empty date flag (computed before), End date (desc) and use a second tMap to make a join on both branches (on Account x Product), only keeping First Match in order to keep the first record as per our requirement.

obiee12c dashboard prompts running before analysis filters

I have an analysis that uses a filter in order to limit the results.
I put this analysis into a Dashboard together with a Dashboard prompt.
The Dashboard prompt consists of various columns and all of them are of type "Choice list" and all have the option "Limit values by" = "All prompts".
However, this is not working as I expected. I thought that the values appearing in he Choice list should be limited by the filters applied in the analysis but it seems that the dashboard prompt first shows all the possible values before having applied the analysis filter.
Is this correct?
If this is the way it works, the problem I am facing is that some of the values appearing in the Choice list of the prompt columns will result in NO DATA in the analysis.
Thanks for your help!
"I thought that the values appearing in he Choice list should be limited by the filters applied in the analysis"
Exactly the other way around. Prompts send their selected values to the filter that's in the analysis and hence cut off the data stream.
It is normal that a prompt retrieves selection values for which a certain point of view retrieves no data. Other way round would make no sense. Imagine you sell 5 products and one didn't sell at all in August. Do you want to remove August from your month prompt?
The interdependence of prompts that you mention is for example - limit regions to only regions of a selected country. Limit customers to only customers of a selected business unit etc.
What you write and expect is that the prompt should go over the effective data (facts) and only retrieve values for which data (facts) exists. As said above that's not the most logical thing to do in an analytical environment since one change of point of view can mean that data "exists" or "doesn't exist" - then you change the point of view and the situation changes. And you want that. You don't want to hardcode points of view which over time or when somebody else looks at the data (personalized data security) they will get different results.
Don't hardcode too much. Don't restrict the system artificially.
Update: https://imgur.com/BxGnbbB
Here's a screenshot of where you can restrict the prompt

OBIEE 11g Sort Pivot Prompt

I have created a query that selects user base data from two different weeks, uses a MSUM to work out the difference between the two weeks and then create a projection of base size across different verticals based on the net change.
This requires the use of a pivot table with prompts to display just the data from the most recent financial week (in format YYYY-MM), however, every time a new week rolls around, it resets the ordering in the pivot prompt to show the least recent week, which makes the calculations redundant.
I can't re-order the weeks in the base data, as the MSUM calc requires a specific order to be used across multiple dimensions.
Whilst this is very easily fixed by the end user each time by changing the drop down, or by the support team by editing the pivot table and changing the prompt before saving, (which then persists until the next week), it is either going to be a poor customer experience, or extra work for the support group.
Is there a method that I'm missing to create a sort on the pivot prompt options from within the pivot table options?
The equation follows this kind of logic...
"Metrics"."Base Size" + (
(
(
"Metrics"."Base Size" - (
MSUM ("Metrics"."Base Size", 2) - "Metrics"."Base Size"
)
) / [days in time period]
) * 365
)
OBI will order the data as defined by the sort order in the RPD, but ascending is probably the best choice for it at that level.
In your case you could put the Analysis on a dashboard and use a dashboard prompt instead. For that you have the ability, in the options, to change the "Choice List Options" to SQL Results. This should put in a default query, to which you could add an ORDER BY clause. You can also set that to default to the most recent/current period no matter the sort order of the column.
SELECT "Date"."Financial Week"
FROM "My Subject Area"
ORDER BY "Date"."Financial Week" DESC
Instead of using the MSUM() function, you may also be better to use one of the built in time-series functions that can get the value of a previous period for you, without having to rely on any ordering. Have a look into the Ago() function to get the previous period.

How to get Current and Previous Year details in report

Hi i am facing a problem where in report level i will give prompt for year
based on prompt result i should get previous year details also
Any suggestions would be helpful
first of all dublicate the query. For the second query, you must create two variables in the universe level. Both of these variables will capture the prompt values and do the year subtraction. Now back to second query , instead of prompts , you should use these previously created variables.
If you can create/modify the query yourself, you can play with date arithmetic, some examples in SQL Server can be found here: http://www.devx.com/dbzone/Article/34594, if you don't use SQL Server, you can look for the especific functions of your database by googling "date arithmetic [Your Database]".

Resources