Date range selection from session/server variables - possible solution
I've recently been creating some reports who'se selection is based on the contents of a session variable, using this against a date field. Thought I'd share with everyone how I did it.
1/ Create a server/static variable called DATE_FORMAT who'se contents are 'dd/mm/yy' . Note, should include the single quotes.
2/ Create 2 session variables that represent the beginning/end date range for your selection you are after - in my case, it was the first & last date of the previous month, PREVIOUS_PERIOD_FROM and PREVIOUS_PERIOD_TO
3/ In the selection, add a filter on the date field in question, set the Operator as "is between".
4/ for each of the 2 valaues, select Add->SQL expression and enter:
EVALUATE('TO_DATE(%1,%2)',VALUEOF(NQ_SESSION."PREVIOUS_PERIOD_FROM"),VALUEOF("DATE_FORMAT"))
and
EVALUATE('TO_DATE(%1,%2)',VALUEOF(NQ_SESSION."PREVIOUS_PERIOD_TO"),VALUEOF("DATE_FORMAT"))
HI,
U can check the Select Quert by using IN s_option.
Like eg:--
Select * form Zemp where empno in s_empno.
Hope this example will help u...
here Zemp is a table...... empno is a field s_empno is a Select-option.
Thanks and rEgards
Suraj S Nair
Similar Messages
-
Date Range Selection in Query Templates
Hi,
Can someone please tell me how to use <b>Date Range Selection</b> Tab details in SQL Query and TAG Query (Using Examples).
Thanks in advance
Muzammil P.T>>>>>>>>>>
Re: Date Range Selection in Query Templates
Posted: Feb 15, 2007 6:43 AM in response to: Muzammil Ahamed Reply E-mail this post
Hi Muzammil,
In data range section you can have multiple options like setting start datetime and end datetime.. And you can set the shift (or) time period and also the format of the time periods.
Primarily we use the start date and end date querying to fetch data between two time labels. I can explain this one with example..
You have batch production table with columns Production Time, Batch Id, Production Qty. Then you want all the details between the 02/02/2007 to 05/02/2007.
Solution :
1.Map 02/02/2007 with Start date.
2.Map 05/02/2007 with end dare.
Now these two become the variables [SD] and [ED].
Now you have mentioned the date range, but you need to mention for which column these things to be applied. For that
3.In Query tab enter Production Time column name in Date column at the bottom.
Now you have written query like Select * from batch prodcution where production time > 02/02/2007 and production time < 05/02/2007.
4. Even those values you mapped (SD and ED) you can change from the front page through Java script.
Like wise you have so many other advantages also.
If you have any other specific doubt let me know.
Thanks,
Rajesh.
PS : Please ward points if answer is useful. <<<<<<<<
Message was edited by:
David Dreyer -
About Date Range Selection in Contributor Recognition Program- List
Hello SCN,
Happy that we have a classified date range selection like Year wise, Contest period wise and also with date range in the Top Contributors list. However earlier we had a luxury to see the point classified as "All Time Contribution". I personally feel to get back this option as well in the list.
Dear SDNers share your suggestion on this.
Thanks,
SaNv....Hi,
If you want the user to select the date directly rather than entering, you need not to have a dropdown menu in WAD. Directly go to the query which you have selected for the object in WAD, there create a variable with calendar. Put it mandatory, so that the user selection of the date will be mandatory. The variable will be automatically be available when you execute the template inn the browser.
Assign points if this helps u.
Regards,
Koundinya. -
Display of 2 rows of data for 2 different date range selection
Hi Folks,
I have a requirement as follows,
User has an option of selecting 2 Date Ranges
From and To Date and again From and To Date
The result should display 2 different rows of data with From and To Date range selection.
Eg:
12/09/20008 to 03/09/2009 10 20 30 40
23/10/2009 to 18/12/2010 40 20 10 30
Difference 30 0 20 10
% Change x y z q
Thanks for your input.
Regards,
KJYou will need to use union report, and you would have fours union's in this report.
Union - 1: Data from 1st Date Range
Union - 2: Data from 2nd Date Range
Union - 3: Variance Calculation
Union - 4: Percentage Variance Calculation.
If the date's are coming from the same field, use cast function to use the same column twice in your prompts. Apply filters on each union as needed.
Thanks. -
Select from SQL Server Activity
Hi,
I'm using the Select from SQL Server Activity in CPO to look up some values in a table, straightforward SQL queries like select * from Table work 100% but when I start applying a WHERE clause to the query it fails to return the results even though when running query in SQL studio it returns results successfully.
The issue seems to be when trying to use brackets in a OR statement:
The SQL Statement is:
SELECT AppName FROM METADaaS WHERE
NCCX NOT LIKE '%18421%'
AND RTYPE='A'
AND BUNDLEDWITH LIKE '%GOL Back Office%'
AND (NCC = '0' OR NCC LIKE '%18421%')
This returns no results in CPO but in SQL Studio returns the results as expected.
If I remove the "(NCC = '0' OR NCC LIKE '%18421%')" I get results in CPO.
thanksAny SQL statement should work. I would suggest you open a TAC case.
-
URGENT ! JDEV 10.1.2 Problem with data control generated from session bean
I got a problem with data control generated from session bean which return a collection of data transfer object.
The dto's seem to be correct. The session bean load correctly the data into and the object's are plenty of data. Using the console to display the dto content is ok.
When generating a data control from this session bean and associate the dto included in the collection only the first object level and one-to-one dto object are correctly setted in the data control. Object that represent collection into the dto (one-to-many foreign key) are setted as collection with an iterator but the structure of the object is not setted. I don't know how to associate this second level of collection with the dto bean class to obtain the attributes definition.
I created a case with hr schema like the hrApp demo application in the tutorial with departments and employees table. I got the same problem.
Is it a bug ?
It exists a workaround to force the data control to understand the collection data structure ?
Help is welcome ! this is urgent !!!we found the problem by assigning the child dto bean class to the node representing the iterator in the xml file corresponding to the master dto.
-
Drop Down Box for Date Range Selection
I have multiple queries on the same worksheet with different variables for each. To simplify changing the one consistent variable, the date range, I have added a drop down box tied to all infoproviders in the query. This would work if I wanted to select a single date but I cannot determiine how to select a date range (01/2010 - 12/2010). Any ideas on how I might accomplish this? I am using Netweaver 7.1.
You can use two single-input variables: one for DATE FROM and the other for DATE TO and use them in query definition to restrict the date (restriction type: Range between DATE FROM and DATE TO).
Then you create two dropdown boxes, one for each variable.
Regards,
Dorota -
Dear friends,
How to select the record from BSEG table between Date range. Please give me the solution . Am also try to find the solution in SDN also.
select-options post_dt for bkpf-budat obligatory default sy-datum NO-EXTENSION.
select belnr budat from bkpf into corresponding fields of table it_head
where bukrs eq compcode
and gjahr eq year
and blart eq doctype
and budat in post_dt
order by belnr budat.
For this select query is working in perfect for single date only. But i want to select the date date range wise.
Thanks
Saravanan RHI,
U can check the Select Quert by using IN s_option.
Like eg:--
Select * form Zemp where empno in s_empno.
Hope this example will help u...
here Zemp is a table...... empno is a field s_empno is a Select-option.
Thanks and rEgards
Suraj S Nair -
How to use 2 Dropdown box in webapplication for date range selection
Dear all,
I am working on a report that will show 2 drop down boxes. These should be used as a date range.
This works fine if I use 2 variables as a date range on 0CALYEAR. However I dont want the user to fill in the dates but selecting the dates with 2 drop down boxes.
I cannot manage to get this to work. I saw some comments about user exits in the forum but I cannot figure it out if there is an easier way.
Could you give me an idea of what to do?
Thanks a lot,
AndreasHi,
If you want the user to select the date directly rather than entering, you need not to have a dropdown menu in WAD. Directly go to the query which you have selected for the object in WAD, there create a variable with calendar. Put it mandatory, so that the user selection of the date will be mandatory. The variable will be automatically be available when you execute the template inn the browser.
Assign points if this helps u.
Regards,
Koundinya. -
Hello
i have a table with records
id number , start_date date , end_date date .
I want to select all ids that are with in an acceptable date range
ex. table data ( mm/dd/yyyy)
1 , 1/1/2008 , 1/4/2008
2. 1/3/2008 , 1/10/2008
3 1/12/2008 , 1/15/2008
4 1/4/2008 , 1/8/2008
5 1/5/2008 , 1/6/2008
i want to find all ids that the dates between 1/3/2008 and 1/4/2008
exists in their date range
acceptable record ids are 1 ,2 and 4
Thank youi want to find all ids that the dates between 1/3/2008 and 1/4/2008
select id from your_table
where start_date <= to_date('1/4/2008')
and end_date >= to_date('1/3/2008')Cheers, APC
Blog : http://radiofreetooting.blogspot.com/ -
Split a Date Range N days into N row, possible?
hi all,
i am planning to create a view for my peoplesoft custom component
Record structure
Employee id | Date From | Date To
123 | 10-Aug-2010 | 13-Aug-2010
Can it convert into a view with the following row?
Employee | Date
123 | 10-Aug-2010
123 | 11-Aug-2010
123 | 12-Aug-2010
123 | 13-Aug-2010
Thanks for the helpSBH wrote:
Try it as below
WITH C AS
SELECT 123 EMPID,TO_DATE('10-Aug-2010','DD-MM-YYYY') STDT,TO_DATE('13-Aug-2010','DD-MM-YYYY') ENDT
FROM DUAL
SELECT EMPID, DT
FROM (SELECT EMPID, STDT+LEVEL-1 DT
FROM C
CONNECT BY LEVEL <= (ENDT-STDT+1)
SQL> /
EMPID DT
123 10-AUG-10
123 11-AUG-10
123 12-AUG-10
123 13-AUG-10
Works ok for a single row of data, but not if there are multiples with different date ranges. For that you'd need something more along the lines of...
SQL> ed
Wrote file afiedt.buf
1 WITH c AS
2 (
3 select 123 as empid, to_date('10-Aug-2010','DD-MM-YYYY') as stdt, to_date('13-Aug-2010','DD-MM-YYYY') as endt from dual union all
4 select 234, to_date('17-Aug-2010','DD-MM-YYYY'), to_date('25-Aug-2010','DD-MM-YYYY') from dual
5 )
6 -- END OF TEST DATA
7 select empid, stdt+x.rn-1 as dt
8 from c, (select rownum as rn from dual connect by rownum <= (select max(endt-stdt+1) as mx_rn from c)) x
9 where stdt+x.rn-1 <= endt
10* order by empid, stdt+x.rn-1
SQL> /
EMPID DT
123 10/08/2010 00:00:00
123 11/08/2010 00:00:00
123 12/08/2010 00:00:00
123 13/08/2010 00:00:00
234 17/08/2010 00:00:00
234 18/08/2010 00:00:00
234 19/08/2010 00:00:00
234 20/08/2010 00:00:00
234 21/08/2010 00:00:00
234 22/08/2010 00:00:00
234 23/08/2010 00:00:00
234 24/08/2010 00:00:00
234 25/08/2010 00:00:00
13 rows selected.
SQL> -
I didn't see an obvious way of accomplishing this. Is this possible?
Right click on the Control and navigate to Create>Property Node. Now on the newly created node, right click on it where it says Visible and navigate to Properties>Description. This will output a string of the controls description. Now grow the node by right clicking and selecting Add Element. On on the property, right click and navigate to Properties>Data Range>All Elements. This will generate a cluster with all the range info.
Ed
Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences. -
Date range selection in abap code in infopackage
Hi!
I have a field called "OPEN_DATE".
When the infopackage is runned, I need the abap code to fint the current date, and from that, make a date range from the first day of current month to the last day of current month
Ex:
Current date = 12.12.2008
Abap code should extract 01.12.2008 - 31.12.2008
Thanks!Hi helge,
Data: l_idx like sy-tabix.
Data: date_low like sy-datum,
date_high like sy-datum.
Date_low = sy-datum.
date_low+6(2) = '01'.
CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
EXPORTING
DAY_IN = Date_low
IMPORTING
LAST_DAY_OF_MONTH = date_high
read table l_t_range with key
fieldname = 'OPEN_DATE'.
l_idx = sy-tabix.
Pass Range values to L_T_Range Table.
Move date_low to L_T_Range -Low.
Move date_high to L_T_Range -High.
L_T_Range -Sign = u2018Iu2019. *****(Here: I u2013 Include, E u2013 Exclude)
L_T_Range -Option = u2018BTu2019.****( Here: BT u2013 Between )
modify l_t_range index l_idx.
p_subrc = 0.
Regards, -
Unable To Select From SQL Server table with more than 42 columns
I have set up a link between a Microsoft SQL Server 2003 database and an Oracle 9i database using Heterogeneous Services (HSODBC). It's working well with most of the schema I'm selecting from except for 3 tables. I don't know why. The common denominator between all the tables is that they all have at least 42 columns each, two have 42 columns, one has 56, and the other one, 66. Two of the tables are empty, one has almost 100k records, one has has 170k records. So I don't think the size of the table matters.
Is there a limitation on the number of table columns you can select from through a dblink? Even the following statement errors out:
select 1
from "Table_With_42_Cols"@sqlserver_db
The error message I get is:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message [Generic Connectivity Using ODBC]
ORA-02063: preceding 2 lines from sqlserver_db
Any assistance would be greatly appreciated. Thanks!Not a very efficient and space friendly design to do name-value pairs like that.
Other methods to consider is splitting those 1500 parameters up into groupings of similar parameters, and then have a table per group.
Another option would be to use "vertical table partitioning" (as oppose to the more standard horizontal partitionining provided by the Oracle partition option) - this can be achieved (kind of) in Oracle using clusters.
Sooner or later this name-value design is going to bite you hard. It has 1500 rows where there should be only 1 row. It is not scalable.. and as you're discovering, it is unnatural to use. I would rather change that table and design sooner than later. -
MySQL: SELECT * FROM with a Variable from an HTML form
Hello,
I would like to insert the variable "find" from the HTML form below in the MySQL "SELECT * FROM" query beneath it. In other words, where the word "santafe" appears below, I would like to insert the variable "$find." But I can't quite get it to work. How do I do it?
Thanks in advance,
John
<form action="tsearch11.php" method="post">
<label>Enter Topic:
<input type="text" name="find" size="55"/>
<input type="hidden" name="searching" value="yes" />
<input type="submit" name="search" value="Search" />
</label>
</form>
Then, on tsearch11.php:
<?
mysql_connect("mysqlv3", "username", "password") or die(mysql_error());
mysql_select_db("sand2") or die(mysql_error());
$find = strip_tags($find);
$find = trim ($find);
$t = "SELECT * FROM santafe";
$y = mysql_query($t);
?>Putting a form variable in a SQL query to look for table or column names requires an extra level of security. You need to create an array of the valid names, and check that the form variable is in that array.
$find = get_magic_quotes_gpc() ? stripslashes($_POST['find']) : $_POST['find'];
$find = mysql_real_escape_string(trim($find));
// create an array of valid table names
$tables = array('santafe', 'sanfernando', 'guadalupe');
// check that the variable is in the permitted array
if (in_array($find, $tables)) {
$t = "SELECT * FROM $find";
$y = mysql_query($t);
} else {
$error = 'Sorry, you selected an invalid table.';
In the page itself, check whether $y exists before using it. Otherwise display the error:
if (isset($y)) {
// display the results
} elseif (isset($error)) {
echo $error;
Maybe you are looking for
-
I store my iTunes media folder on my external hard drive and can no longer find it there. It seemed to becomd lost after I re-designated the default iTunes media location. I had downloaded some things from iTunes without my external hard drive plug
-
Hi, we have the funding to replace our current developer workstations which are currently Dell Precision 690's. Two reasons: the first is abysmal quality control issues we've had with these since receiving them, and two, discovering that the integrat
-
Can you get and use internet explorer for mac?
I am wondering If I can obtain and use internet explorer?
-
Simulating Acccounting Document before billing is created ( VF01 )
Hi All, We are on ECC6.00 . As it is a standard feature that SD billing is created and then the billing details are submitted to create accounting document . If the system fails to create the the FI document, the billing docuemt still exists in th
-
Draw a pen path, then a script to select/copy and close activeDocument
Is this possible? I do this step 90 times every day: Select a image area drawing a pen path zone, and copying it to the clipboard. Then close without save. Then I use the selection on clipboard to paste it on the previous opened image. P.S. I use pat