Default Prompt to first day of current month on OBIEE - oracle11g

I have a Analysis created in OBIEE 11G, by default I want it to have the default values in: is between Calendar Date [First day of current month] - [Yesterday]. For the first day i use the following (but didn't work):
TIMESTAMPADD (SQL_TSI_DAY, (DAYOFMONTH (CURRENT_DATE) * -1) + 1, CURRENT_DATE)

Here you go ChiHam!
First, I created an analysis and filtered for the desired date column as "is prompted" ("Canonical"."Date" in this example).
http://i58.tinypic.com/29vjqye.jpg
Then, I setup a Dashboard Prompt (I chose to put it on a dashboard page, but you should be able to simply go to the "Prompt" tab if you're only running the analysis. Use a column prompt, select the "is between" operator, and select "choice list" for user input. Now the tricky part! Open the options using the small plus sign at the bottom left. Select "SQL Results" for Choice List Values and insert this SQL (you will need to change "Table"."Date" and "Subject Area" to your own date column and subject area):
SELECT "Table."Date" FROM "Subject Area" UNION SELECT TIMESTAMPADD(SQL_TSI_DAY,-1,CURRENT_DATE) FROM "Subject Area"
Now to set the defaults! Select "SQL Results" for Default Selection as well. Insert in the first text box the beginning of the month date using this SQL:
SELECT TIMESTAMPADD (SQL_TSI_DAY, (DAYOFMONTH (CURRENT_DATE) * -1) + 1, CURRENT_DATE) FROM "Subject Area"
Insert yesterday's date using this SQL into the next text box:
SELECT TIMESTAMPADD(SQL_TSI_DAY,-1,CURRENT_DATE) FROM "Subject Area"
http://i57.tinypic.com/294hpuv.jpg
Then I put both objects (Dashboard prompt and analysis) onto a dashboard page.
htt p://i57.tinypic.com/35i0opi.jpg (delete 'space' in link, sorry posting limitations)
The results were my dashboard prompt was defaulted to the correct dates as of today (5/24) and my analysis was already run based of the dates without having to hit apply because the analysis is set to "is prompted".
htt p://i58.tinypic.com/efs9pz.jpg (delete 'space' in link, sorry posting limitations)
Hope this answers your question!

Related

Date cleaning in excel,date values align to the left

I have excel file a date column, some of date are align to the right while others to the left.when i read the into r am getting this error.
Expecting date in A3547 / R3547C1: got '13/04/2018'
on dates align to the left. I have tried to clean the date in excel with no success,
You can do something similar to this
I have extracted the day, month and year from the string date using
some formulas
After that I have recreated the actual date from the
extracted day, month and year values
Formulas are as below
B2: =FIND("/",A2)
C2: =FIND("/",A2,1+FIND("/",A2))
D2: =LEFT(A2,B2-1)
E2: =MID(A2,B2+1,C2-B2-1)
F2: =RIGHT(A2,4)
G2: =DATE(F2,E2,D2)
Depending upon your actual data you may need to amend the formulas a little bit.
Please check whether all the cells in the column has date format and same date format.
Sometimes dates can be enter as text strings or other custom formats. Then there is a possibility to getting error like this.
This is how the data looks like in excel, both date and text
Load the same in MS Excel Power Query Editor, select the date column, Under the Transform Tab select "Split Column, By Delimiter", select "/" as the delimiter and Click OK. This separated the date into Month, Day and Year+Time.
Highlight the Day Column first, then Month, then Year+Time ...in that order, and then click "Merge Columns" under the Transform Tab.
Highlight the now Merged column and under "Data Type", select "Date/Time". You can now go back to the Home tab and Select Close & Load to get the cleaned data into Excel... as below;

Using "Allow Text Entry" result as Piped Data in a Loop & Merge block

I have a multiple select option that allows text entry for an "other" choice at the bottom. Then I use the selected options from that question in a Loop & Merge block with a collection of other questions. I can the piped text variable ${lm://Field/1} to get the selected question, as a header for the next block, for example:
Please tell me more about ${lm://Field/1}
But on the "other" choice, that will just say:
Please tell me more about other
I would like it to use the value of the Text Entry field, but I can't find a piped text variable that would give me that.
You want to pipe "Selected Choices - Entered Text" aka:
${q://QID1/ChoiceGroup/SelectedChoicesTextEntry}
That will pipe the text entry of the selected choice(s) that have text entry and the selected choice(s) for the choices that don't have text entry.
Follow the steps below:
In Loop & Merge you choose "Loop based off of a question", and
select the choose-all-that-apply Multiple Answer question that has
the "Other" question with "Allow text entry" set to on.
In the adjacent drop down, choose "Selected Choices - Entered Text [object Object]".
Now, in your questions inside your Loop and Merge block, pipe the Loop & Merge field in the normal way with ${lm://Field/1}.

Prompt comes up when running report

I have created a report from the following query
SELECT TasksEntries.Project, TasksEntries.Task, Sum(TimeTracker.WorkHours) AS
TotalHours
FROM TasksEntries INNER JOIN TimeTracker
ON (TasksEntries.EmployeeId = TimeTracker.EmployeeId) AND (TasksEntries.TaskID
= TimeTracker.TaskId)
GROUP BY TasksEntries.Project, TasksEntries.Task;
The start and end dates are captured from a form and passed like shown below. WorkDate is a column in the TimeTracker table and is not present in any other table.
strWhere = "WorkDate BETWEEN #" & txtMgrRptStartDate & "# AND #" &
txtMgrRptEndDate & "#"
DoCmd.OpenReport "rptTotalProjectHours", acViewPreview,
"qryTotalProjectHours", strWhere, acWindowNormal
When the report is invoked, I get a box where it says
"Enter parameter value" for Workdate.. I am unsure why I get that.
The query runs fine when I run it separately with the start and end dates hard coded in there. The problem seems to occur only when it is passed through the docmd.openreport. Can someone help me get to the bottom of this? When passing the WorkDate thru the OpenReport, is it mandatory that the column name be present in the SELECT statement?
Appreciate your help in advance.
I solved it by including the date criteria in the WHERE clause of the SELECT statement and specifying the form text box names of start and end dates.
The other thing that I did was to eliminate the query name from the Docmd.openreport since the report was created from the named query.

sqlite3 from windows command promt

CREATE TABLE texhisowntable (age INTEGER, name (32));
in this emty TABLE i write infomation. First age, Second name up to 32, (string, numbers, ore chars i don't know witch one you would try, but i write Words )
..so lets do it:
INSERT INTO texhisowntable (age, name) VALUES(100, ''TheJavaRockS>|<RwithTheGoldenAxE");
so now im TheJavaRockS>|
SELECT * FROM texhisowntable;
and my command would say:"ACDC, let it Play, you are old but you look fine"
//he would print : TheJavaRockS>|
but im old and i forget things, so who knows how i can see, how i created the table.
I only want rom the commandprommt he print's
CREATE TABLE texhisowntable (age INTEGER, name (32));
13 ago, i answer my own Question. With the command ".schema" it shows every table for example in the file "thnkhsu.db" where also the TABLE "texhisowntable" is.
If you got much TABLES, and search only, the one you like, for example the "texhisowntable" in the file "thnkhsu.db" you only need to write
".schemas texhisowntable" and the command shows, how i created the TABLE.
;) its very simple

SQL Developer: Load Data Date error

I am using Oracle SQL Developer 3.0.03. I am trying to upload an Excel file to an Oracle data table. I am getting an error for the date. The column in the database is a timestamp and I don't know what to put into the date format for the 'Data Load Wizard'. If I use the following format (dd-mom-yy hh.mi.ss), SQL Developer will show the following error:
--Insert failed for row 1 TIMESTAMP_COLUMN GDK-05047: A day of the month must be between 1 and the last day of the month.
--Row 1
INSERT INTO TABLE_1 (Column1, Column2, Column3, TIMESTAMP_COLUMN) VALUES ('Some Text','Some Text','Some more text',to_timestamp('40604.0', 'dd-mon-yy hh.mi.ss'));
The default number format IN EXCEL is: 40604.0
Which if you change the cell to a short date format you will get: 3/2/2011
I am trying to figure out what 'Format' I need to put into the FORMAT section of the 'DATA Load Wizard' that will accept the date format that is in EXCEL and upload it to Oracle as a TIMESTAMP.
I ran into the same thing today, and 'fixed' this two ways. The second way probably seems too complex, but it might help someone if they have a hard time automating the formatting of dates to look like Oracle's standard dd-mmm-yy.
Format the date columns in Excel as dd-mmm-yy and import directly into the table.
Highlight the column(s)
Choose "More Number Formats" where the existing format is (In Excel 2010, it says General in a dropbox on the Home tab
Select the last entry "Custom" in the Category box
Manually enter dd-mmm-yy in the Type: box
Format the date columns in Excel as mm/dd/yy, import the table in as text, write a manual insert statement from the temp text table using TO_DATE(date_field,'MM/DD/YYYY')
Highlight the column(s)
Choose "More Number Formats" where the existing format is (In Excel 2010, it says General in a dropbox on the Home tab
Select the "Date" entry in the Category box
Choose "03/14/01" from the list
The Excel "zero" date is January 0 (yes, zero), 1900. Since Oracle can't handle a "zero" day in a month you need to subtract 1 from the Excel value; thus the following should get you close to what you want:
SELECT CAST(TO_DATE('01-JAN-1900 00:00:00', 'DD-MON-YYYY HH24:MI:SS') AS TIMESTAMP) +
NUMTODSINTERVAL(41017.6361109954 - 1, 'DAY')
FROM DUAL
As far as "how to import it" goes, there's no Oracle date format that I'm aware of to do this. The easiest thing would be to import the value into a NUMBER column and then run a script to do the date conversion.
Share and enjoy.
yeah and that's the problem.
"A day of the month must be between 1 and the last day of the month."
1) how are these decimals created?
2) is this "04-06-2004" ? or are these seconds from 1970?
you need to add more detail about this number format!

Resources