Need of additional date ranges in Campaighn
Hi,
Can any one please explain me the Need of additional date ranges in Campaighn.we have option of creating additional date ranges,Can any one give live example for this requirement.
Regards
Narayana
Hello Manam,
I think you can add up to 6(not sure though) additional data ranges.
These are the dates relating to 1)Buying dates 2)Predip 3)Post dip dates
4)Promotion dates.
Promotion dates are the dates that are used in TPM where the stock reaches retailer and shelves them and starts selling the good for a promotional price and the price ends on the Promotion end date.
Please reward if this helps.
regards,
Muralidhar Prasad.C
Similar Messages
-
Additional Date range in Marketing Plan/Campaign
Hi All,
I am working CRM 7.0 webui, i know in SPRO under Marketing we have option to define additional date range for marketing project, i have added the some date fields in Marketing Plan and Campaign but still i am not able to see the additional date range in Marketing Plan or Campaign in webui, please tell if there are any additional configuration needs to be done for this.
Thanks,
Dipesh.Hi Dipesh,
For every additional date range you define, you will have to define a context objects of type CPGDateRange and relate it to campaign. SAP has already provided 5 such addtional context objects from Daterange1 to Daterange5. To get these on web ui, you will have to do UI customization and implement getter and setter methods of the attributes for star date and end date.
Hope this information is helpful.
Thanks and Regards,
Sandeep -
Need help with date range searches for Table Sources in SES
Hi all,
I need help, please. I am trying to satisfy a Level 1 client requirement for the ability to search for records in crawled table sources by a date and/or date range. I have performed the following steps, and did not get accurate results from Advanced searching for date. Please help me understand what I am doing wrong, and/or if there is a way to define a date search attribute without creating a LOV for a date column. (My tables have 500,00 rows.)
I am using SES 10.1.8.3 on Windows 32.
My Oracle 10g Spatial Table is called REPORTS and this table has the following columns:
TRACKNUM Varchar2
TITLE Varchar2
SUMMARY CLOB
SYMBOLCODE Varchar2
Timestamp Date
OBSDATE Date
GEOM SDO_GEOMETRY
I set up the REPORTS table source in SES, using TRACKNUM as the Primary Key (unique and not null), and SUMMARY as the CONTENT Column. In the Table Column Mappings I defined TITLE as String and TITLE.
Under Global Settings > Search Attributes I defined a new Search Attribute (type Date) called DATE OCCURRED (DD-MON-YY).
Went back to REPORTS source previously defined and added a new Table Column Mapping - mapping OBSDATE to the newly defined DATE OCCURRED (DD-MON-YY) search attribute.
I then modified the Schedule for the REPORTS source Crawler Policy to “Process All Documents”.
Schedule crawls and indexes entire REPORTS table.
In SES Advanced Search page, I enter my search keyword, select Specific Source Group as REPORTS, select All Match, and used the pick list to select the DATE OCCURRED (DD-MON-YY) Attribute Name, operator of Greater than equal, and entered the Value 01-JAN-07. Then the second attribute name of DATE_OCCURRED (DD-MON-YY), less than equals, 10-JAN-07.
Search results gave me 38,000 documents, and the first 25 I looked at had dates NOT within the 01-JAN-07 / 10-JAN-07 range. (e.g. OBSDATE= 10-MAR-07, 22-SEP-07, 02-FEB-08, etc.)
And, none of the results I opened had ANY dates within the SUMMARY CLOB…in case that’s what was being found in the search.
Can someone help me figure out how to allow my client to search for specific dated records in a db table using a single column for the date? This is a major requirement and they are anxiously awaiting my solution.
Thanks very much, in advance….raford,
Thanks very much for your reply. However, from what I've read in the SES Admin Document is that (I think) the date format DD/MM/YYYY pertains only to searches on "file system" sources (e.g. Word, Excel, Powerpoint, PDF, etc.). We have 3 file system sources among our 25 total sources. The remaining 22 sources are all TABLE or DATABASE sources. The DBA here has done a great job getting the data standardized using the typical/default Oracle DATE type format in our TABLE sources (DD-MON-YY). Our tables have anywhere from 1500 rows to 2 million rows.
I tested your theory that the dates we are entering are being changed to Strings behind the scenes and on the Advanced Page, searched for results using OBSDATE equals 01/02/2007 in an attempt to find data that I know for certain to be in the mapped OBSDATE table column as 01-FEB-07. My result set contained data that had an OBSDATE of 03-MAR-07 and none containing 01-FEB-07.
Here is the big issue...in order for my client to fulfill his primary mission, one of the top 5 requirements is that he/she be able to find specific table rows that are contain a specific date or range of dates.
thanks very much! -
**PLEASE HELP**Need Help adding date ranges to form
I have designed a form with approximately 28 user defined date fields. I want the user to be able put in the first date range and then seautomaticaly fill in the other dates sequencially.
ie,.... the user puts in 08/01/2007 then the following date field populates with 08/02/2007, then 08/03/2007 and so on....The following script can be used for the "exit" action so the basic action to get the start date's number and then it can be used to compute the next days field values by adding the appropriate number of days. A more experienced user could use a control loop t0 modify the field names and number of days to add to the start date's day number for the additional date fields.
// Script for exit from date select field
// perform calculation only if an input date has been selected
if (HasValue(cInputDate)) then
// format string for the date fields
var cDateFormat = "MMM D, YYYY"
// intermediate information start - optional
xfa.host.messageBox(Concat("The input date formatted value is: ", cInputDate.formattedValue, "
The input date's numeric value: ", Date2Num($.formattedValue, cDateFormat), "
The adjusted date number is: ", (Date2Num($.formattedValue, cDateFormat) + 1), "
The adjusted date is: ", Num2Date(Date2Num($.formattedValue, cDateFormat) + 1) ),
"Intermediate Detail", 3, 0)
// intermediate information end - optional
var StartDateNumber = Date2Num($.formattedValue, cDateFormat)
// add 1 day to StartDateNumber
cAdjustDate = Num2Date(StartDateNumber + 1, cDateFormat)
// add code for additional date fields here adding appropriate number of days for date
else
cAdjustDate = "" // no input keep field blank
// add code for additional date fields here
endif -
Need suggestions on date range query
I have a requirement to show the amount of product remaining. There is a table that holds updated "inventory" amounts with a date and tonnage, and a series of transactional tables that detail the individual disbursements from the stockpile. The trick is that the dates for the inventory adjustments may not all be the same, meaning that I need to individually resolve the stockpiles.
This query will give me the inventory disbursements:
select FN_STN_KEY(j.FACTORY_ID, j.STATION_ID) as STATION,
count(j.LOAD_JOB_ID) as LOADS,
CASE SUM(w.SPOT_WEIGHT)
WHEN 0 THEN SUM(NVL(j.MAN_SPOT_WT,0))
ELSE SUM(w.SPOT_WEIGHT)
END TONS
from TC c, TC_LOAD_JOBS j, SPOT_WEIGHTS w
where c.TC_ID = j.TC_ID
and c.DATE_INDEX = w.DATE_INDEX and j.LOAD_RATE_ID = w.LOAD_RATE_ID
and c.DATE_INDEX BETWEEN to_date('09/01/2009','MM/DD/YYYY') and sysdate
and FN_STN_KEY(j.FACTORY_ID, j.STATION_ID) in (810,410)
group by FN_STN_KEY(j.FACTORY_ID, j.STATION_ID);Note that the date and the list of stations in the where clause are dynamic and selected by user. If this was only one station at a time it wouldn't be this complicated.
This query will give me the last known inventory amount:
select to_char(MAX(AS_OF_DT),'Mon DD, YYYY'), TONS
from STATION_LOG
where AS_OF_DT < sysdate and STN_KEY in (810,410) group by TONS;Again, the date and list of stations are selected by user. They should be identical to those selected for the other query.
Does anyone have any good ideas on how to combine these two statements into a single report?
Note: FN_STN_KEY acts as a join function. You don't really want me to get into why there isn't a single unique key to reference.Hi,
I'm trying to follow your descrioption, but lots of things don't make sense to me.
blarman74 wrote:
Yeah. I put in some data so I could get the message back to you, then filled in the rest.
So the user is going to pass in two parameters: The date of the report and the list of stations they want to get an inventory count on. What were the parameters that produced the output you posted before:
STATION INITIAL_TONS USED_TONS AS_OF_DATE
810 835500 465100 09/01/2010
410 495800 366900 09/02/2010
550 568900 122600 08/31/2010
What I need the report to do is
1) take a station from the list
2) find out the inventory tally from STATION_LOG where the date is the largest date less than the supplied date. This should give me AS_OF_DATE and my initial quantity.
3) query the data table for all tons hauled from the AS_OF_DATE for that station.
4) repeat for the next station.So this is what your existing PL/SQL code does. A non procedural language, like SQL, won't follow the same steps, of course.
The sample data for station_log is:
INSERT INTO STATION_LOG (1, to_date('08/31/2010','MM/DD/YYYY'), 810, 562500);
INSERT INTO STATION_LOG (2, to_date('09/02/2010','MM/DD/YYYY'), 410, 495500);
INSERT INTO STATION_LOG (3, to_date('09/01/2010','MM/DD/YYYY'), 910, 832600);
INSERT INTO STATION_LOG (4, to_date('12/31/2010','MM/DD/YYYY'), 810, 239800);How do you get the initial_tons in the output above from the data above? Did you mean to post some new sample data for station_log?
I still get ORA-00928 errors from all the INPUT statements.
As I said, I can do it inside a loop in PL/SQL, but I got completely stumped on how I could accomplish this in SQL. The trick is that if I can do it in SQL, I can allow the user to export the data to csv using built-in functionality. If I have to do it in PL/SQL, I can't provide the export as easily.
One more thing I just thought about, I am going to need to use a BETWEEN on the dates of the data I need to grab. I obviously don't want to grab data past another inventory tally record from STATION_LOG for the same station, and I can use an NVL so it cuts off at SYSDATE. I obviously haven't hauled anything in the future ;)I doubt if I'll get enough information to do this for you before I leave on vacation.
Here's an example of what you need to do using the scott.emp table instead of your station_log table:
SELECT job
, hiredate
, sal
FROM scott.emp
ORDER BY job
, hiredate
JOB HIREDATE SAL
ANALYST 03-Dec-1981 3000
ANALYST 19-Apr-1987 3000
CLERK 17-Dec-1980 800
CLERK 03-Dec-1981 950
CLERK 23-Jan-1982 1300
CLERK 23-May-1987 1100
MANAGER 02-Apr-1981 2975
MANAGER 01-May-1981 2850
MANAGER 09-Jun-1981 2450
PRESIDENT 17-Nov-1981 5000
SALESMAN 20-Feb-1981 1600
SALESMAN 22-Feb-1981 1250
SALESMAN 08-Sep-1981 1500
SALESMAN 28-Sep-1981 1250Say we want to find, for each job in a given list, the sal that corresponds to the last hiredate that is no later than the given report_date. (This seems pretty close to what you heed: fior each stn_key in a given list, the quantity that corresponds to the last row that is no later than the given report_date.)
That is, if we're only interested in the jobs CLERK, MANAGER and PRESIDENT, and only in hiredates on or before December 31, 1981, the output would be:
JOB LAST_HIREDA LAST_SAL
CLERK 03-Dec-1981 950
MANAGER 09-Jun-1981 2450
PRESIDENT 17-Nov-1981 5000That is, we want to ignore all jobs that are not in the given list, and all rows whose hiredate is after the given report_date. Among the rows that remain, we're interested only in the last one for each job.
Note that the last_sal for CLERK is not 1300 or 1100: those values were after the given report_date. also, the last_sal for CLERK is not 800; that's not the last one of the remaining rows.
Here's one way to get those results in pure SQL:
DEFINE jobs_wanted = "CLERK,MANAGER,PRESIDENT"
DEFINE report_date = "DATE '1981-12-31'"
SELECT job
, MAX (hiredate) AS last_hiredate
, MAX (sal) KEEP (DENSE_RANK LAST ORDER BY hiredate) AS last_sal
FROM scott.emp
WHERE hiredate <= &report_date
AND ',' || '&jobs_wanted' || ',' LIKE
'%,' || job || ',%'
GROUP BY job
ORDER BY job
;I used substitution variables for the parameters. You could use bind_variables, or hard-code the values instead.
The WHERE clause is applied before aggreate functions are computed, so rows after &report_date don't matter.
"MAX (sal) KEEP (DENSE_RANK LAST ORDER BY hiredate)" means the sal that is associated with the last row, in order by hiredate. If there happens to be a tie (that is, two or more rows have exactly the same hiredate, and no row is later) then the highest sal from thsoe rows is returned; that's what MAX means here. Ties may be impossible in your data.
You need to write a similar query using your station_log table, and join the results of that to your load_data table, including only the rows that have dates between the date in the sub-query (last_hiredate in my example) and the parameter report_date. That can be part of the join condition. -
Need to specify date range for query result.
Below is my query. The query as is is working fine. The columns 'totalCalls' , 'totalOrders' and 'totalSCs' are all stored by date. I have created a form where the user can specify a start and end date. How would I change this query to report within those specified dates.
<cfquery name="qZVPData_Western" datasource="xxxxxx">
SELECT UserID,
TMName,
UserZone,
AVG(WeekCallGoal) AS WCG,
AVG(QTCallGoal) AS QTCG,
(SELECT COUNT(*)
FROM Sales_Calls
WHERE Sales_Calls.UserID = u.UserID) as totalCalls,
(SELECT COUNT(*)
FROM Orders
WHERE Orders.UserID = u.UserID) as totalOrders,
(SELECT SUM(Quantity)
FROM ProductOrders PO
WHERE PO.UserID = u.UserID AND PO.NewExisting = 1) as newItems,
(SELECT SUM(NewExisting)
FROM ProductOrders PO_
WHERE PO_.UserID = u.UserID) as totalNew,
(SELECT COUNT(ServiceCall_ID)
FROM ServiceCalls SC
WHERE SC.UserID = u.UserID) as totalSCs,
(SELECT COUNT(UserID)
FROM TMStatusLog TSL
WHERE TSL.UserID = u.UserID AND TSL.Status = 'Vacation') as TSLdays1,
(SELECT COUNT(UserID)
FROM TMStatusLog TSL
WHERE TSL.UserID = u.UserID AND TSL.Status = 'TradeShow') as TSLdays2,
(SELECT COUNT(UserID)
FROM TMStatusLog TSL
WHERE TSL.UserID = u.UserID AND TSL.Status = 'Admin Day') as TSLdays3,
SUM(TSLdays1)+(TSLdays2)+(TSLdays3) AS TSLdays,
SUM(totalOrders)/(totalCalls) AS closePerc,
SUM(totalOrders)/(totalCalls) - (.30) AS GRV,
SUM(totalSCs)+(totalCalls)-(QTCG) AS PerVar,
(SUM(totalSCs) + totalCalls + (TSLdays*WCG/5))/QTCG AS PerCalls
FROM Users u
WHERE UserZone = 'Western'
GROUP BY UserZone, UserID, TMName
</cfquery>
I figured I could add this to the columns WHERE statements;
'AND Column BETWEEN #FORM.Start# AND #FORM.End#' but this isn't working.
Any ideas???What is the SQL being generated by your <cfquery> contents? Is it valid SQL? This is always the first thing to check when you get SQL errors back from the DB... check what you're sending to the DB.
Second: don't hard-code dynamic values into your SQL string, pass them as parameters.
Re all the subqueries: it runs fine in dev. Have you tried to load test it? If poss move your subqueries to the FROM statement, as then they're only run once per recordset. As opposed to once per row of the result set, when the subqueries are in the SELECT or WHERE statement.
Adam -
Hi,
There is a requirement that we need to get date range.This date range will be arrived at using the function module BKK_GET_PRIOR_WORKDAY. The factory calender id is GB. It should return the date range. Therefore, for weekends the date range will be Saturday, Sunday and Monday. The date range will change based on holidays that exist in the holiday calendar.
Now my question is how to calculate that there are two days between friday and monday.
Please help.Hi Nishigandha,
If i am correct you need the number of days between two dates
ex:
date1: 04/06/2009
date2: 12/06/2009
you need the number of days??
then probably check this Fm out:
SD_DATETIME_DIFFERENCE this is a function module which gives the difference in Days and Time for entered two dates
P.S Additionally Chk this out:
/people/mustafabaris.gunes/blog/2009/03/16/calculating-number-of-working-days-in-query-level
Hope its useful
Thanks and Regards
Srikanth.P
Edited by: SRIKANTH P on Jun 4, 2009 2:33 PM -
What is 'date range' in SAP CRM?
I am SAP CRM beginner. Also very new to SDN. Reading very basic documents.
While reading Marketing related document (Campaign Management), I have come accross a term called ' date range ' where I am really confused with -
what is - date range, pre-dip- post-dip, buying period........
& what is the use of the same.hi
date range specifies that in a particular transaction what is the validity of the transaction,for example LEAD<ACTIVITY etc are the transactions we have in CRM
as u said you saw it in campaing management,there date reange specifies the start date and end date opf the campaign
whenever we start a acmapaing after executing it we have some start date from where we got to see the results of the campaign,
you define an additional date range that has a specific meaning, for example, pre-dip or post-dip, you need to select the corresponding period type in this activity. This is used to trigger validation of the dates in the BW System.
You should define at least one buying pattern type in Customizing for Marketing Planning and Campaign Management under Basic Data -> Define Default Buying Pattern Types.
For Instance you can define that the buying period should start weeks before the promotion takes
place and that buying finishes weeks before the end of the promotion. You define the buying period
as a date range in Customizing and then you can enter the actual dates here. A buying pattern can
be defined for each combination of campaign type, buying pattern type and duration.
also technically if u know about date range in CRM
i would like to explain like this that
there is a thing "milestone"
this refers to the range of date from start to end
withinthe particular date that you mention inside the transaction u do the needed task like u create a new task and u do the buying and u generate invoice
in simple terminology we have date range which specifies the start of a particular task and there is always an end date at which this task has to end,so take this way
check out the date range in trade promotion (trade promotion is an alternate for the campaing in CRM)
http://help.sap.com/saphelp_crm60/helpdata/en/46/080afc50e05876e10000000a11466f/frameset.htm
hope it will help you
do revert back in case of any doubt
best regards
ashish -
Long text for a field in Additional Data tab of DMS
i have a field in additional data tab called Name , how can a long text be assigned to that field
Hello Mr. Vijay,
Classification Configuration master data which we need in Additional Data tab. Presently In our SAP system we have limitation for just 30 character for each characteristic if i correct just confirm me please
Regards
Arun kaul -
I am trying to develop a query in MS Access 2010 to join two tables using three joins, one of which is a (between) date range. The tables are contained in Access. The reason
the tables are contained in access because they are imported from different ODBC warehouses and the data is formatted for uniformity. I believe this cannot be developed using MS Visual Query Designer. I think writing a query in SQL would be suiting this project.
ABCPART links to XYZPART. ABCSERIAL links to XYZSERIAL. ABCDATE links to (between) XYZDATE1 and ZYZDATE2.
[ABCTABLE]
ABCORDER
ABCPART
ABCSERIAL
ABCDATE
[ZYXTABLE]
XYZORDER
XYZPART
XYZSERIAL
XYZDATE1
XYZDATE2Thank you for the looking at the post. The actual table names are rather ambiguous. I renamed them so it would make more sense. I will explain more and give the actual names. What I do not have is the actual data in the table. That is something I don't have
on this computer. There are no "Null" fields in either of the tables.
This table has many orders (MSORDER) that need to match one order (GLORDER) in GLORDR. This is based on MSPART joined to GLPART, MSSERIAL joined to GLSERIAL, and MSOPNDATE joined if it falls between GLSTARTDATE and GLENDDATE.
[MSORDR]
MSORDER
MSPART
MSSERIAL
MSOPNDATE
11111111
4444444
55555
2/4/2015
22222222
6666666
11111
1/6/2015
33333333
6666666
11111
3/5/2015
This table has one order for every part number and every serial number.
[GLORDR]
GLORDER
GLPART
GLSERIAL
GLSTARTDATE
GLENDDATE
ABC11111
444444
55555
1/2/2015
4/4/2015
ABC22222
666666
11111
1/5/2015
4/10/2015
AAA11111
555555
22222
3/2/2015
4/10/2015
Post Query table
GLORDER
MSORDER
GLSTARTDATE
GLENDDATE
MSOPNDATE
ABC11111
11111111
1/2/2015
4/4/2015
2/4/2015
ABC22222
22222222
1/5/2015
4/10/2015
1/6/2015
ABC22222
33333333
1/5/2015
4/10/2015
3/5/2015
This is the SQL minus the between date join.
SELECT GLORDR.GLORDER, MSORDR.MSORDER, GLORDR.GLSTARTDATE, GLORDR.GLENDDATE, MSORDR.MSOPNDATE
FROM GLORDR INNER JOIN MSORDR ON (GLORDR.GLSERIAL = MSORDR.MSSERIAL) AND (GLORDR.GLPART = MSORDR.MSPART); -
Do We need access key for Additional Data B in VA01
Hi all,I have to add fields in Additional Data B,I have searched SDN about it and came to know that it is screen '8459' of program 'SAPMV45A',but it is asking key for that,is it safe applying access key for this screen?
Thanks in advance.>is it safe applying access key for this screen?
yes it is safe. SAP provided the screen 8459 only for adding our own custom fields to it. For this you need access key for the first time. along with that you need access key for
PBO include, PAI include
MV45AOZZ ,MV45AIZZ .
check it once. -
Need to create a report to show values for a particular date range
I have to create a report, out of which I need two columns : << Customer Value Variance and Churn Score Variance >> to show values only for a custom date range, which will be entered via a dashboard prompt.
These generic date columns are not present and cannot be added. I have to make use of Pres variables
What I have currently done is:
1) Created a prompt with 2 different date columns and passing those values into variables vStartDate and vEndDate. (I don't actually need those 2 column which I have selelcted, but I have taken those so that I can prompt the values in calendar format and pass onto the variables)
2) Created report with necessary columns, with 2 extra columns (hidden) as vStart Date Column and vEnd Date Column which take the values from the presentation variables defined in the prompt. I have created these columns as then I can reference these in the two required columns if necessary.
I am already facing error in report after doing this and I am confused how to proceed. Any suggestions?
Thanks.Yes, but it only has one generic Date column, no start date and end date. I can't use that twice in the prompt. Although I can specify it to be 'between', but I'm not sure I can pass values to both variables like that.
Currently I have used Campaign Start Date and Campaign End Date to enter values in calender format to the variables. -
Date range related query needed
I have table 'ratemast' with following columns and data
begindate enddate rate1
01-12-2006 10-12-2006 750.00
11-12-2006 25-12-2006 950.00
26-12-2006 02-03-2007 1500.00
the data in begindate and enddate may fall between any date range.
it may be for a week or for a month or even more than that.
i need a query to do the following:
my query will have begindate and enddate for any date range which is not defined in a single row of ratemast.
I need to pick indiviudal date and its respective rate and sum them and it should be divided by number of days.
eg:- if begindate: 09-12-2006 enddate: 13-12-2006
result should be : (750+750+950+950+950)/5
Please help.Hi,
Here's one way... you may have to alter it to check for count(*) = 0 or any other corner cases.
[email protected](152)> create table ratemast(begindate date, enddate date, rate number);
Table created.
Elapsed: 00:00:00.22
[email protected](152)> insert into ratemast(begindate, enddate, rate)
values (date '2006-12-01', date '2006-12-10', 750);
1 row created.
Elapsed: 00:00:00.01
[email protected](152)> insert into ratemast(begindate, enddate, rate)
values (date '2006-12-11', date '2006-12-25', 950);
1 row created.
Elapsed: 00:00:00.00
[email protected](152)> insert into ratemast(begindate, enddate, rate)
values (date '2006-12-26', date '2007-03-02', 1500);
1 row created.
Elapsed: 00:00:00.00
[email protected](152)> commit;
Commit complete.
Elapsed: 00:00:00.04
[email protected](152)> select * from ratemast
2 /
BEGINDATE ENDDATE RATE
01-DEC-06 10-DEC-06 750
11-DEC-06 25-DEC-06 950
26-DEC-06 02-MAR-07 1500
Elapsed: 00:00:00.03
[email protected](152)> var begin_date varchar2(10);
[email protected](152)> var end_date varchar2(10);
[email protected](152)> exec :begin_date := '2006-12-09';
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.01
[email protected](152)> exec :end_date := '2006-12-13';
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.01
[email protected](152)> @ed
Wrote file TEST.BRANDT_152_20070315150352.sql
1 with dates as (
2 select to_date(:begin_date, 'YYYY-MM-DD') + level - 1 as d
3 from dual
4 connect by level <= to_date(:end_date, 'YYYY-MM-DD') - to_date(:begin_date, 'YYYY-MM-DD') + 1
5 )
6 select dates.d
7 , r.rate
8 from dates
9 , ratemast r
10* where dates.d between r.begindate and r.enddate
[email protected](152)> /
D RATE
09-DEC-06 750
10-DEC-06 750
11-DEC-06 950
12-DEC-06 950
13-DEC-06 950
Elapsed: 00:00:00.02
[email protected](152)> ed
Wrote file TEST.BRANDT_152_20070315150352.sql
1 with dates as (
2 select to_date(:begin_date, 'YYYY-MM-DD') + level - 1 as d
3 from dual
4 connect by level <= to_date(:end_date, 'YYYY-MM-DD') - to_date(:begin_date, 'YYYY-MM-DD') + 1
5 )
6 select :begin_date
7 , :end_date
8 , avg(r.rate) as fee
9 from dates
10 , ratemast r
11 where dates.d between r.begindate and r.enddate
12* group by :begin_date
[email protected](152)> /
:BEGIN_DATE :END_DATE FEE
2006-12-09 2006-12-13 870
Elapsed: 00:00:00.01
[email protected](152)> exec :end_date := '2007-01-15';
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.01
[email protected](152)> @ed
Wrote file TEST.BRANDT_152_20070315151840.sql
1 with dates as (
2 select to_date(:begin_date, 'YYYY-MM-DD') + level - 1 as d
3 from dual
4 connect by level <= to_date(:end_date, 'YYYY-MM-DD') - to_date(:begin_date, 'YYYY-MM-DD') + 1
5 )
6 select dates.d
7 , r.rate
8 from dates
9 , ratemast r
10* where dates.d between r.begindate and r.enddate
[email protected](152)> /
D RATE
09-DEC-06 750
10-DEC-06 750
11-DEC-06 950
12-DEC-06 950
13-DEC-06 950
14-DEC-06 950
15-DEC-06 950
16-DEC-06 950
17-DEC-06 950
18-DEC-06 950
19-DEC-06 950
20-DEC-06 950
21-DEC-06 950
22-DEC-06 950
23-DEC-06 950
24-DEC-06 950
25-DEC-06 950
26-DEC-06 1500
27-DEC-06 1500
28-DEC-06 1500
29-DEC-06 1500
30-DEC-06 1500
31-DEC-06 1500
01-JAN-07 1500
02-JAN-07 1500
03-JAN-07 1500
04-JAN-07 1500
05-JAN-07 1500
06-JAN-07 1500
07-JAN-07 1500
08-JAN-07 1500
09-JAN-07 1500
10-JAN-07 1500
11-JAN-07 1500
12-JAN-07 1500
13-JAN-07 1500
14-JAN-07 1500
15-JAN-07 1500
38 rows selected.
Elapsed: 00:00:00.01
[email protected](152)> ed
Wrote file TEST.BRANDT_152_20070315150352.sql
1 with dates as (
2 select to_date(:begin_date, 'YYYY-MM-DD') + level - 1 as d
3 from dual
4 connect by level <= to_date(:end_date, 'YYYY-MM-DD') - to_date(:begin_date, 'YYYY-MM-DD') + 1
5 )
6 select :begin_date
7 , :end_date
8 , avg(r.rate) as fee
9 from dates
10 , ratemast r
11 where dates.d between r.begindate and r.enddate
12* group by :begin_date
[email protected](152)> /
:BEGIN_DATE :END_DATE FEE
2006-12-09 2007-01-15 1243.42105
Elapsed: 00:00:00.01
[email protected](152)> cheers,
Anthony -
Need work around to split date range into months
Hi All,
I have a requirement to split the data range in source table to months.
here is the source table
ID Sdate Edate Code
===============================
501 1/4/2009 4/30/2009 AH
501 5/1/2009 9/30/2009 AB
502 1/1/2014 5/31/2014 AC
Here is my target
ID Sdate Edate Code
================================
501 1/4/2009 1/31/2009 AH
501 2/1/2009 2/28/2009 AH
501 3/1/2009 3/31/2009 AH
501 4/1/2009 4/30/2009 AH
501 5/1/2009 5/31/2009 AB
501 6/1/2009 6/30/2009 AB
501 7/1/2009 7/31/2009 AB
501 8/1/2009 8/31/2009 AB
501 9/1/2009 9/30/2009 AB
502 1/1/2014 1/31/2014 AC
502 2/1/2014 2/28/2014 AC
502 3/1/2014 3/31/2014 AC
502 4/1/2014 4/30/2014 AC
502 5/1/2014 5/31/2014 AC
Please provide some input.
Thanks a lot in advance.That means your database is in a different locale than mine. When I select cast(Edate as varchar), I get the date returned in the format 'YYYY-MM-DD'. That's why I use(left(cast(Edate as varchar),4) + right(left(cast(Edate as varchar),7),2) to get it the format 'YYYYMM' before converting it into an integer.
Your database most probably returns dates in a format like D/MM/YYYY. That's the reason for the error you get. You'll have to select (right(cast(Edate as varchar),4) + left(right(cast(Edate as varchar),7),2) to obtain the same results as I do.
Alternatively, you can use the convert function to obtain the same results:
select max(
cast(left(convert(varchar,Edate,102),4) + right(left(convert(varchar,Edate,102),7),2) as int) + 1 -
cast(left(convert(varchar,Sdate,102),4) + right(left(convert(varchar,Sdate,102),7),2) as int))
FROM src_split'
It's always good practice to test the SQL-statements in your database client first before including them in a DS script.
Also, I suddenly realise this statement will only return the correct result when your Edate and Sdate are always within the same year. If that's not the case, but the gap between Edate and Sdate is always less than 10 years, change your statement to:
select max(
cast(left(convert(varchar,Edate,102),4) + right(left(convert(varchar,Edate,102),7),2) as int) + 1 -
cast(left(convert(varchar,Sdate,102),4) + right(left(convert(varchar,Sdate,102),7),2) as int)) % 88
FROM src_split' -
Dear all,
I am very new to Sharepoint designer 2010. Its better to say, i am just stepping in.
I have sharepoint site which is accessible for all the users to update few information. But i want this site not to be accessible during a date range, say from 15th to 20th of every month.
I am planning to have something like this: If any user tries to access this sharepoint site between 15th to 20th date range of everymonth, then the browser must show an pop-up alert saying "This site is not accessible during this date range" and Redirect
this sharepoint site to someother site (Say http:// somesitename.xx.com) immidiately.
I know very little about how to add Javascript in sharepoint webpart.
Please provide the Javascript or any best alternate solution to my concern.
Thanks in advance.Hi,
From your description, my understanding is that you want to redirect sharepoint site to another site between 15th and 20th every month.
I agree with what Sudip says. If you still want to use JS code,You could try these steps
below:
Open your site with SharePoint Designer.
Click Master Pages in left navigation.
Find file v4.master, and backup it(it is very important).
Right click your v4.master,
choose "Edit File in Adavance Mode".
Add the code below into the <head/> tag.
<script src="https://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script><script
type="text/javascript">
$(document).ready(function(){
var today = new Date();
var day = today.getDate(); // get current day
var id = _spPageContextInfo.userid; // get the id of current logon in user
var boolFlg = false;
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/SiteGroups/GetByName(\'"+"sharepoint Owners"+"\')/Users", //get users in a specified group can access the sharepoint site from 15th to 20th every
month
type: "GET",
headers: {"accept": "application/json;odata=verbose"},
success: function (data) {
if (data.d.results) {
var src = data.d.results;
for(var i = 0; i < src.length; i++){
if(src[i].userid==id){ //check the logon in user in the specified group or not
boolFlg = false;
break;
if(!boolFlg){
if(day <= 20 && day >=15){
alert("This site is not accessible during this date range"); // alert the message
location.href = "http:// somesitename.xx.com"; // redirect to another site
error: function (xhr) {
alert(xhr.status + ': ' + xhr.statusText);
})</script>
Best Regards
Vincent Han
TechNet Community Support
Maybe you are looking for
-
Format NTFS External Hard Drive as MS-DOS or Mac OS X Journaled?
I recently bought a SimpleTech 1TB [re]drive (connected via USB). It came formatted in the Windows NT File System format. I would like to format the drive, but am unsure whether or not I should format it as MS-DOS (aka FAT32) or Mac OS X Journaled. _
-
Loop length for multiple tracks
Is there a way to set the length of loop repitition, for different tracks? I tried this the other day, with two tracks that I set up to loop, and when I adjusted the loop length in the top of the arrange window, both tracks were affected. I want to h
-
How to make Safari stop asking whether to trust app Signature
I'm running Safari 4.0.5 on a Tiger system. When I sign on to my work VPN (I go to a website, enter credentials, and it starts up Network Connect), it always says "this applet was signed by ... and then I have to hit "Trust" or "Don't trust" or "Exam
-
Updating an attribute of the table
Hi., I am using jdev11.1.5 My scenario is: =>i had created a adf table [hd:table name => If the user selects the first row and after clicking the post button an attribute in [ln] table should get updated can anyone pls tell me how to acheive this c
-
ACCESS_VIOLATION at AdobeOwl.dll when call Indesign com interface from windows service
ACCESS_VIOLATION at AdobeOwl.dll when call Indesign CS3 COM interface from windows service application. Does anyone know how to workaround this issue ?