How to get Current and Previous Year details in report - reporting

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]".

Related

Business Objects User Input with Prompts

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?

Informatica cloud: use field in pre/post sql commands

I am trying to delete a set of data in the target table based on a column (year) from the lookup in IICS (Informatica Cloud).
I want to solve this problem using pre/post sql commands but the constraint is I can't pass year column to my query.
I tried this:
delete from sample_db.tbl_emp where emp_year = {year}
I want to delete all the employees in a specific year i get from lookup return
For Ex:
I got year as '2019', all the records in table sample_db.tbl_emp containing emp_year=2019 must be deleted.
I am not sure how this works in informatica cloud.
Any leads would be helpful.
How are you getting the year value? A pre/post SQL may not be the way to go unless you need to do this as part of another transformation, i.e., before or after the transformation runs. Also, does your org only have ICDI, or also ICAI? ICAI may be a better solution depending on the value is being provided.
The following steps would help you achieve this.
Create an input-output parameter in your mapping.
Assign the result of your lookup in an expression transformation to the parameter using SetMaxVariable
Use the parameter in your target pre SQL as
delete from sample_db.tbl_emp where emp_year = $$parameter
Let me know if you have any further questions

How to use repository or presentation variables in BI publisher?

We have a report on BIP that shows data based on three parameters. One of these is date parameter. What I want to do is to schedule that report to be sent to emails with date parameter set to last 'working' day of last month. Working day means that last day of last month may not be last working day of last month since it may be sunday or some holiday.
For this purpose I created repository variable that gets this working day. When I checked this variable in OBIEE it worked fine. However, in BIP, I couldn't use that variable to set default value of the date parameter.
What can I do? Maybe I can set parameter's default value by SQL expression? Or is there any way to use repo variable in BIP?
In case you haven't searched on Oracle support yet, you can only use repository variables if you use OBIEE as your data source.
syntax: valueof("variable")

Can't get WORKDAY function to work with a COUNTIF

Trying to work on a system at work that will tell how many error codes were registered by a particular machine on the previous workday. This spreadsheet will need to be able to select only the errors generated on the previous date as this will become a rolling list of data generated across a wide time span. Currently working with the formula
=TODAY(),-1,B2:B17)
where the last array is some shutdown days I've put in to generate a global variable "Yesterday" and trying to use the formula
=COUNTIF(Table1[DateOnly],"="&Yesterday)
to gather the number of records that occurred yesterday.
Can anyone tell me where I'm going wrong?
Found that the issue was when I tried to convert the timestamp in mm/dd/yy hh:mm:ss format to mm/dd/yy and didn't realize that the other information was still hiding in there and confusing the formula. One of my coworkers recommended the use of a ROUNDDOWN function in the use of =ROUNDDOWN(argument,0) to get rid of the time information and just leave me with date.

Toad for Oracle bind variables with IN clause

I have a query that looks like this:
select * from foo where id in (:ids)
where the id column is a number.
When running this in TOAD version 11.0.0.116, I want to supply a list of ids so that the resulting query is:
select * from foo where id in (1,2,3)
The simple minded approach below gives an error that 1,2,3 is not a valid floating point value. Is there a type/value combination that will let me run the desired query?
CLARIFICATION: the query as shown is how it appears in my code, and I am pasting it into TOAD for testing the results of the query with various values. To date I have simply done a text replacement of the bind variable in TOAD with the comma separated list, and this works fine but is a bit annoying for trying different lists of values. Additionally, I have several queries of this form that I test in this way, so I was looking for a less pedestrian way to enter a list of values in TOAD without modifying the query. If this is not possible, I will continue with the pedestrian approach.
As indicated by OldProgrammer, the Gerrat's answer that "You can't use comma-separated values in one bind variable" in the indicated thread correctly answers this question as well.

Resources