Difficulty working with overlapping date ranges and sums
I have data like the following and need help querying it for a specific result:
startdate enddate place class number
03-30-2006 04-18-2006 A 22 2000
04-01-2006 04-30-2006 A 22 6000
03-30-2006 04-15-2006 B 11 1700
03-15-2006 04-12-2006 B 11 2900
I'd like to return the sum of the averages for any given day, by place, and by class, like this:
day place class average
03-15-2006 B 11 100
03-16-2006 B 11 100
03-30-2006 A 22 100
03-30-2006 B 11 200
03-31-2006 A 22 100
03-31-2006 B 11 200
04-1-2006 A 22 300
04-01-2006 B 11 200
04-30-2006 A 11 200
I'm stuck, any help would be GREATLY appreciated.
307b218a-cebe-46f1-87b6-946b4076ce79 wrote:
Here is what I said in my original post:
I'd like to return the sum of the averages for any given day, by place, and by class.....Then gave an example of output.
I think that sentence describes the relations perfectly succinctly.
How can it, when there's no SUM involved
307b218a-cebe-46f1-87b6-946b4076ce79 wrote:
For the date of 3-30-2006, the sum of the averages for region A in class 22 is 100, since from 3-30-2006 to 4-18-2006 is 20 days, and 2000/20 = 100, and there are no other class 22's in place A in that date range. Same goes for 3-31-20006.
However for 4-1-2006 the sum of the averages is 300, since I have one record who's average is 100 (2000/20), and another (6000/30 = 200) and 200 + 100 = 300.
For 4/30, I have one average in that range for place A class 22, and its average for that period is 200.
Does that help?
Much better, thank-you ..
try this:
WITH data AS (
SELECT TO_DATE('03-30-2006','mm-dd-yyyy') startdate, TO_DATE('04-18-2006','mm-dd-yyyy') enddate, 'A' place, 22 class, 2000 cnumber FROM DUAL UNION ALL
SELECT TO_DATE('04-01-2006','mm-dd-yyyy') startdate, TO_DATE('04-30-2006','mm-dd-yyyy') enddate, 'A' place, 22 class, 6000 cnumber FROM DUAL UNION ALL
SELECT TO_DATE('03-30-2006','mm-dd-yyyy') startdate, TO_DATE('04-15-2006','mm-dd-yyyy') enddate, 'B' place, 11 class, 1700 cnumber FROM DUAL UNION ALL
SELECT TO_DATE('03-15-2006','mm-dd-yyyy') startdate, TO_DATE('04-12-2006','mm-dd-yyyy') enddate, 'B' place, 11 class, 2900 cnumber FROM DUAL ),
data2 AS ( SELECT startdate, enddate, enddate-startdate+1 numdays, place, class, cnumber
FROM data d
SELECT startdate+x.lvl day, place, class, cnumber/numdays avg
FROM data2 d,
( SELECT level lvl FROM dual CONNECT BY level <= 10000 ) x
WHERE x.lvl <= numdays
ORDER BY d.startdate, x.lvl
It helps to be specific and detailed
Similar Messages
-
Find totals of a date range and sum
How do I find totals between a date range like from 0 up to 60 days from today, 61 to 90 days from today, 91-120 days, 120 and above. Please advise.
Do I use a Add_Months function to convert to days?Try this,
This may help you
SQL> select sysdate,sysdate+interval '60' day from dual;
SYSDATE SYSDATE+INTERVAL'60'DAY
5/5/2008 2: 7/4/2008 2:17:16 PM
SQL>G. -
Hi, I am sure this is a pretty regular question but I can not find an answer anywhere. I have a database of pruducts (product_name) with various experation dates (exp_date) For one of my pages I want to display all products that will expire in the next 30 days. How would I do this? Thanks, Paul
You don't say which database you're using, but with MySQL you would use one of the many date and time functions.
SELECT * FROM product_name
WHERE date_exp BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 30 DAY) -
iPad Air iOS 8.1 Stock Photo App. 14000 Photos. Overlapping date ranges in Moments. What is the criteria used for deciding after import where photos are included in Moments. I was expecting each day to have its own exclusive slot for example, not 26 - 27 January 2007 with 8 photos then 27 January 2007 1 photo. Why is there not two seperate slots, one for the 26th and one for 27th?? This makes locating photos by day more arkward than it need be and seems to follow no logic. This occurs over 150 times and is very confusing. Is this an issue or expected behaviour?
iPad Air iOS 8.1 Stock Photo App. 14000 Photos. Overlapping date ranges in Moments. What is the criteria used for deciding after import where photos are included in Moments. I was expecting each day to have its own exclusive slot for example, not 26 - 27 January 2007 with 8 photos then 27 January 2007 1 photo. Why is there not two seperate slots, one for the 26th and one for 27th?? This makes locating photos by day more arkward than it need be and seems to follow no logic. This occurs over 150 times and is very confusing. Is this an issue or expected behaviour?
-
Hi All
I need some advice on the below, it works, gives the answers I want, but I believe the filter on the set can be moved to a where clause, and the MTD can work effectively then with the sum of the date range on the [RangeHasResponse] measure (advice apart
from "if it ain't broke don't fix it" ;) ). This is query for a report where I can sub in a param date range (set the Today value, and the from in the DateRange), and produce the Sum of Has Response across that date range, and also the MTD
for last month up to the ToDate.
Any advice on how the MDX could be better structured would be great, I can understand I'm calculating members, then adding them to my query, it just seems I should be calculating them in the SELECT based on a filter. Output just needs to be
[MTD]: single sum of Has Response to the current todate for that month
[RangeHasResponse]:Sum of the entire range
[Has Response] : sum on the last day, this isn't necessary, I'm just curious to see how that would tie into a filter, if it ruins the above leave it out.
WITH
SET [ToDate]=[Date].[Year - Quarter - Month - Date].[Date].&[2014-02-22T00:00:00]
SET [DateRange] =
[Date].[Year - Quarter - Month - Date].[Date].&[2014-01-01T00:00:00]:
[ToDate].item(0)
MEMBER [Measures].[MTD] AS
SUM(MTD([Date].[Year - Quarter - Month - Date].CurrentMember),[Measures].[Has Response])
MEMBER [Measures].[RangeHasResponse] AS
SUM([DateRange],[Measures].[Has Response])
SELECT
{[Measures].[MTD],[Measures].[Has Response],[Measures].[RangeHasResponse] } on columns
,[ToDate] on rows
FROM
[ISD Prototype]
Thanks
Best Wishes, The Redman; If something helps, please help show it by voting, if it solves, bonus!Hi GGoldspink,
In MDX, the CREATE MEMBER statement defines calculated members that are available throughout the session, and therefore, can be used in multiple queries during the session. So if the members can will be used in multiple times in SELECT clause, we can create
a calculated member, and then use this members on SELECT clause which will improve the query performance.
In your scenario, are there any performance issue in your MDX query? In this case, I'd suggest you enable SQL Sever profiler to monitor the queries, and check which part in the query took a very long time to run. Here is a useful link for your reference.
http://sqlmag.com/database-performance-tuning/using-sql-profiler-tune-mdx-queries
Besides, here is a document which will help you understand where issues can occur in your existing MDX code that will prevent you from experiencing the performance improvements, and provide advice on how to avoid these issues in your new MDX coding.
http://technet.microsoft.com/en-us/library/bb934106(v=sql.105).aspx
Regards,
Charlie Liao
If you have any feedback on our support, please click
here
Charlie Liao
TechNet Community Support -
My iPad Mini with retina display suddenly will not connect to the Internet. It shows full wifi bars, yet no web pages will load. My Internet is working with all other apple devices in my house. The iPad also no longer works with celluar data. I'm not sure what has happened. It was working fine a few hours ago. I have tried resetting it, ive restarted my browser etc. I tried to erase all data from my Ipad but I can't do that because it needs to sign into my Apple ID and use the Internet!
Some things to try first:
1. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
2. Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
3. Change the channel on your wireless router (Auto or Channel 6 is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
4. Go into your router security settings and change from WEP to WPA with AES.
5. Renew IP Address: (especially if you are drooping internet connection)
• Launch Settings app
• Tap on Wi-Fi
• Tap on the blue arrow of the Wi-Fi network that you connect to from the list
• In the window that opens, tap on the Renew Lease button
6. Potential Quick Fixes When Your iPad Won’t Connect to Your Wifi Network
http://ipadinsight.com/ipad-tips-tricks/potential-quick-fixes-when-your-ipad-won t-connect-to-your-wifi-network/
~~~~~~~~~~~~~~~~~~~~~~~~~
Fix WiFi Issue for iOS 7
http://ipadnerds.com/fix-wifi-issue-ios-7/
iOS 6 Wifi Problems/Fixes
Wi-Fi Fix for iOS 6
https://discussions.apple.com/thread/4823738?tstart=240
How To: Workaround iPad Wi-Fi Issues
http://www.theipadfan.com/workaround-ipad-wifi-issues/
Another Fix For iOS 6 WiFi Problems
http://tabletcrunch.com/2012/10/27/fix-ios-6-wifi-problems-ssid/
Wifi Doesn't Connect After Waking From Sleep - Sometimes increasing screen brightness prevents the failure to reconnect after waking from sleep. According to Apple, “If brightness is at lowest level, increase it by moving the slider to the right and set auto brightness to off.”
Fix For iOS 6 WiFi Problems?
http://tabletcrunch.com/2012/09/27/fix-ios-6-wifi-problems/
Did iOS 6 Screw Your Wi-Fi? Here’s How to Fix It
http://gizmodo.com/5944761/does-ios-6-have-a-wi+fi-bug
How To Fix Wi-Fi Connectivity Issue After Upgrading To iOS 6
http://www.iphonehacks.com/2012/09/fix-wi-fi-connectivity-issue-after-upgrading- to-ios-6.html
iOS 6 iPad 3 wi-fi "connection fix" for netgear router
http://www.youtube.com/watch?v=XsWS4ha-dn0
Apple's iOS 6 Wi-Fi problems
http://www.zdnet.com/apples-ios-6-wi-fi-problems-linger-on-7000004799/
~~~~~~~~~~~~~~~~~~~~~~~
iPad: Issues connecting to Wi-Fi networks
http://support.apple.com/kb/ts3304
How to Boost Your Wi-Fi Signal
http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Boost-Your-Wi-Fi-Signal.h Mt
Troubleshooting a Weak Wi-Fi Signal
http://ipad.about.com/od/iPad_Troubleshooting/a/Troubleshooting-A-Weak-Wi-Fi-Sig nal.htm
How to Fix a Poor Wi-Fi Signal on Your iPad
http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Fix-A-Poor-Wi-Fi-Signal-O n-Your-iPad.htm
iOS Troubleshooting Wi-Fi networks and connections http://support.apple.com/kb/TS1398
iPad: Issues connecting to Wi-Fi networks http://support.apple.com/kb/ts3304
WiFi Connecting/Troubleshooting http://www.apple.com/support/ipad/wifi/
How to Fix: My iPad Won't Connect to WiFi
http://ipad.about.com/od/iPad_Troubleshooting/ss/How-To-Fix-My-Ipad-Wont-Connect -To-Wi-Fi.htm
iOS: Connecting to the Internet http://support.apple.com/kb/HT1695
iOS: Recommended settings for Wi-Fi routers and access points http://support.apple.com/kb/HT4199
How to Quickly Fix iPad 3 Wi-Fi Reception Problems
http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
iPad Wi-Fi Problems: Comprehensive List of Fixes
http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
Connect iPad to Wi-Fi (with troubleshooting info)
http://thehowto.wikidot.com/wifi-connect-ipad
10 Ways to Boost Your Wireless Signal
http://www.pcmag.com/article2/0,2817,2372811,00.asp
Fix iPad Wifi Connection and Signal Issues http://www.youtube.com/watch?v=uwWtIG5jUxE
Fix Slow WiFi Issue https://discussions.apple.com/thread/2398063?start=60&tstart=0
How To Fix iPhone, iPad, iPod Touch Wi-Fi Connectivity Issue http://tinyurl.com/7nvxbmz
Unable to Connect After iOS Update - saw this solution on another post.
https://discussions.apple.com/thread/4010130
Note - When troubleshooting wifi connection problems, don't hold your iPad by hand. There have been a few reports that holding the iPad by hand, seems to attenuate the wifi signal.
Some Wi-Fi losses may stem from a problematic interaction between Wi-Fi and cellular data connections. Numerous users have found that turning off Cellular Data in Settings gets their Wi-Fi working again.
You may have many apps open which can possibly cause the slowdown and possibly the loss of wifi. In iOS 4-6 double tap your Home button & at the bottom of the screen you will see the icons of all open apps. Close those you are not using by pressing on an icon until all icons wiggle - then tap the minus sign. For iOS 7 users, there’s an easy way to see which apps are open in order to close them. By double-tapping the home button on your iPhone or iPad, the new multitasking feature in iOS 7 shows full page previews of all your open apps. Simply scroll horizontally to see all your apps, and close the apps with a simple flick towards the top of the screen.
Wi-Fi or Bluetooth settings grayed out or dim
http://support.apple.com/kb/TS1559
~~~~~~~~~~~~~~~
If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
Cheers, Tom -
Using a sparse lookup with a date range?
Hey all,
I have created a table (Benchmark_Lookup) that contains the following columns:
start_date, end_date, section, benchmark
I then have numerous logical tables (Eg Business Growth) that will all have a new logical column performing a sparse lookup on the above table to retrieve it's benchmark value.
In the lookup table, I have multiple rows for the same section with different benchmarks differentiated by the date range that they were in effect.
I have worked out how to perform this lookup using the following:
lookup(SPARSE "bla".Benchmark_lookup"."Benchmark" ,0, "bla"."Business_Growth"."section")
Unfortunately, the above is now bringing back duplicates as it's not working out what date range to select from.
I have joined the lookup table (using a physical join) to my Time dimension by saying "business_date >= start_date and business_date <= end_Date" but that doesn't seem to work.
Any ideas?Hi there,
Neither of these examples help that much.
I understand how the lookup function works but what happens if the lookup table has the following two rows:
EFFECTIVE_FROM EFFECTIVE_TO SECTION SCORE
01/Jan/1900 30/Jun/2013 test 1
01/Jul/2013 06/Jun/2079 test 2
I need to use the following lookup rules:
Business_Date >= Effective_From
Business_Date <= Effective_To
Section = 'Test'
The lookup should therefore only ever return one row as the date is used to find the appropriate range. -
Mailbox Export - Filtered for Date Range and Body Content
I have been pulling my hair out with this one and hopefully someone can help.
I need to search a mailbox and export all (sent & received) messages that fit in a date range and also have a specific word in the body. The query I am using doesn't seem to find the term at all, but the messages it does find fit within my date range,
so part of it seems to work. The request was to not use wildcards too, only looking for the specific word in the body. Here is my one-liner...
New-MailboxExportRequest -ContentFilter {(Body -like "Something") -and (Received -gt "07/01/2012") -and (Received -lt "07/31/2012") -or (Sent -gt "07/01/2012") -and (Sent -lt "07/31/2012")} -Mailbox "SearchMailbox"
-Name "Label1" -FilePath \\server\temp\pst\Export.pst
I've also tried to search for a common word like "the" just to make sure it wasn't a case of the term simply not being in mailbox. No dice.Hi,
Agree with Nickeyclayton, you can use (body -like "*something*") instead of (body -like "something").
I recommend you refer to the following article:
Filterable Properties for the -ContentFilter Parameter
Property
Description
Values
Example syntax
Body
This property returns messages that have the specified string within the message body.
String
Wildcard
-ContentFilter {Body -like "*prospectus*"}
Hope this helps!
Thanks.
Niko Cheng
TechNet Community Support -
Problem in working with Japanese data
Hello,
We have an application, which should work for both English and Japanese languages. Our application is working fine for English data but in case of Japanese, we are facing problems. In the application, there is a language setting, where the user can select either English or Japanese. This changes the language of the labels to English or Japanese. We are handling this thru' ResourceBundles. But the data that is entered can be independent of this. In English setting also, the data entered or diplayed could be Japanese. Now we are facing problems at vaious places -
1. When we enter Japanese data and save it, it gets copied into the bean and if there is any error in the saving, the same data from bean comes back on the screen. This data doesn't appear properly in Japanese.
2. When we try to retrieve the already saved data from database, it doesn't show poperly in Japanese.
We are using our own 'toUnicode' function, which converts the data to Unicode before saving the data to database. Similarly, we have tried different encodings like SJIS / Shift_JIS / ISO-2022-JP at various places i.e. in 'Page' directive or in HTML Meta tag or various combinations of these two. Nothing is working reliably. Sometimes for some combination, data retained in the first case is correct but it can't be saved. Sometimes it works with Unicode, sometimes without Unicode. Some combination affects the Japanese labels as well. Otherwise the labels at least are displayed properly.
The same code with just Shift_JIS setting in 'page' directive, worked well in IIS Server for both English and Japanese.
What could be the problem in WebLogic? Does it matter if WL is installed on English or Japanese machine?
Kindly answer ASAP, since the project is getting delayed.
Thanking in anticipation...
-MedhaHi,
is there a difference in handling Japanese and Chinese chars? If not I
might be able to give you some hints.
Daniel
-----Original Message-----
From: JSB [mailto:[email protected]]
Posted At: Monday, February 12, 2001 6:22 PM
Posted To: internationalization
Conversation: Problem in working with Japanese data
Subject: Re: Problem in working with Japanese data
Have u solved this yet, and how ?
Medha <[email protected]> wrote in message
news:[email protected]...
>
Hello,
We have an application, which should work for both English andJapanese
languages. Our application is working fine for English data but in case
of
Japanese, we are facing problems. In the application, there is a
language
setting, where the user can select either English or Japanese. This
changes
the language of the labels to English or Japanese. We are handling this
thru' ResourceBundles. But the data that is entered can be independent
of
this. In English setting also, the data entered or diplayed could be
Japanese. Now we are facing problems at vaious places -
1. When we enter Japanese data and save it, it gets copied into thebean
and if there is any error in the saving, the same data from bean comes
back
on the screen. This data doesn't appear properly in Japanese.
2. When we try to retrieve the already saved data from database, itdoesn't show poperly in Japanese.
We are using our own 'toUnicode' function, which converts the datato
Unicode before saving the data to database. Similarly, we have tried
different encodings like SJIS / Shift_JIS / ISO-2022-JP at various
places
i.e. in 'Page' directive or in HTML Meta tag or various combinations of
these two. Nothing is working reliably. Sometimes for some combination,
data
retained in the first case is correct but it can't be saved. Sometimes
it
works with Unicode, sometimes without Unicode. Some combination affects
the
Japanese labels as well. Otherwise the labels at least are displayed
properly.
The same code with just Shift_JIS setting in 'page' directive,worked
well in IIS Server for both English and Japanese.
What could be the problem in WebLogic? Does it matter if WL isinstalled on English or Japanese machine?
Kindly answer ASAP, since the project is getting delayed.
Thanking in anticipation...
-Medha -
Help Required: Working with relational data
Hi,
I'm looking for some advice
Scenario
We have a customer who has an SE relational database with Apex for transaction processing. They require reporting functionality and are debating whether to buy BI SE One or BI EE; they will not buy the enteprise edition database though.
Questions
Here are my questions:
1. In order to use answers and dashboards, does the relational data have to be in a dimensional format. Is this reccommended.
2. We were debating on whether to create data marts for various business requirements. Is this standard procedure for relational data (Which is not too complex)
3. If the data has to be in a dimensional format, is this best modelled using warehouse builder or the model layer of the repository using BI Administrator. (Baring in mind that the customer is an SME using a SE database)
The main problem where having, been fairly new to warehouse building, is that we dont know what the best path is to take when working with relational data. Do we create dimensional models? What should we use? Is a relational structure suitable enough?
Can anyone shed light on our problems
Regards
Kevin1. In order to use Answers and Dashboards you do not need to have a Data Warehouse. It can report out of both Transactional database as well as a data warehouse.
2. It depends on what your business requirements are. BI EE/SE1 does not require you to have data marts. Data Marts would give performance gains, would help you in visualizing the transactional data from a business standpoint, is a big plus but not a mandate. If you want to go that route of creating Datamarts, you can easily do that using BI SE1 since that gives you warehouse builder which can be both used as a data modelling tool and a ETL tool.
3. Warehouse Builder is a ETL tool. It helps in you visualizing/deploying data warehouses in databases. But BI EE Admin tool is more of a logical dimension modelling tool wherein the facts and dimensions do not exist physically but the tool uses them to do the querying/processing.
Since you are just starting, what you can do is to use BI EE directly on top of the transactional system for the time being. But as a long term solution you can start working on your data marts and as soon as they are ready you can port the BI EE on top of them rather than the transactional system.
Thanks,
Venkat
http://oraclebizint.wordpress.com -
Moving multiple files by date range and/or file name filtered
I need to move multiple files by date range and/or by filename (using a filter) to another directory.
OR
How can I get the attributes of files in a directory, something you would see when typing in "dir" in a DOS or ls in UNIX. I can parse this info and then make a array of files to move.
The reason for needing this is that I need to move files that are located in another country, and sort them into different directories based on date. Having to read each file for it's file information adds wasted time that I can't afford. I am about to create a dos terminal to do a "dir" command to get the information and parse it out.. but I was hoping LV had a function that can get me that info so I don't have build it.
THanks.You should use the 'File/Directory Info' functionality.
This will return the last modificatoin of the file.
Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be! -
Xcelsiues 2008, working with live data help!!!
Ok, so i have flynet designer for web services. All this is working correctly. i have setup a test query just to check everything is working so i just pulled out some customer info name, account number etc. I generated the webservice succesfully and i can browse to the website and enter a parameter and it returns results. So i know this part is working ok.
So now im in xcelsius 2008, i add a new web service connection and it connects fine, at this point you have to select the cells where you want the data to go in the little excel spreadsheet panel. but nothing ever appears!!!!??? i dont know what i am doing wrong. has anyone had experience working with live data?In terms of timescale. I have till April to do this.
I said 2 months cos things always come up. So, in terms of your application have you already:
collected user requirements?
developed and tested an appropriate database structure (tables, datatypes, triggers, views, etc...)?
done any mock-up of some sort of the application pages and business process flows?
gotten approval of any of the above?
If you have all of this yet to complete - and you're new to databases, new to Oracle and new to HTML DB, and have more than a very simple application (10-15 pages) you may still be in over your head with this project.
I'm not trying to discourage you from using HTML DB at all. It's a great tool and you can do some very cool stuff with it. And it's reputation as an Access killer is well deserved. It's just that you may not want to take on a critical time-sensitive project as your first.
Also to consider - are you going to have anyone else helping out with it? If so, what strengths/weaknesses does that person bring to the project? Is it going to help you move faster? Or slow you down - because you're training and developing at the same time?
Earl -
Working with ODIInvokeWebServices: As Source and Target
Hi All,
I've been playing around with ODI, and now Im curious with ODI Invoke Webservice.
I read the info from Oracle site and says that the WSDL as a source , has to be translated to an XML. Then work with the data as an XML.
What about if i want to send the WSDL to a target? How do I generate the WSDL in ODI, and how do I send it? Is it possible?
Regards,
Dave Null
Edited by: 929710 on Jun 21, 2012 8:58 PMAnybody out there, can confirm if we can use ODIInvokeWebService to send data?
Edited by: 929710 on Jun 28, 2012 3:14 AM
Edited by: 929710 on Jun 28, 2012 3:16 AM -
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 -
my iPhone 5c sound/speaker only works with the headphones in and when I'm trying to change a ringtone in settings.. why is this?! its not on airplane mode, its not on silent, ive tried turning it on and off, software is up-to-date etc. just no sound for text alerts or when trying to play music/videos. Help!
same issue as this guy it's a hardware issue
https://discussions.apple.com/thread/6266690?tstart=0
Maybe you are looking for
-
Phone no longer recognized by my computer or my wall charger...HELP
After the 2.0 upgrade had a few issues, still have a few of the apps quitting etc. these I can deal with while waiting for the fixes. The big problem is the phone now cannot connect to the computer or the charger, tried different cables {still can ch
-
Yesterday I went to the Apple Store and asked about buying a new 27" iMac and connecting it to my 24" Cinema Display. I was told that I could do that with an adapter and was sold a Mini DisplayPort to DVI Adapter. When I got home I realized that wasn
-
I would like to know about technical details of new ThinkPads T430u and X1 hybrid.
I am interested in T430u and X1 hybrid. I would like to know the difference of both product. If I looking for the thin, light, durable, high-performance, and long-life battery laptop, which one should be suitable for me?
-
Content Database large after removing BLOB
My content database was 3 gigs before removing BLOB. In the process of removing BLOB, it required a merge which moved all of the files from the BLOB to my content database and made it 32 gigs. I then deleted the site containing all of the documents,
-
How do I get credit for an app that wouldn't download and I had to delete?
I bought an app and it downloaded to my iPhone but then wouldn't even open. I had to finally delete it and purchase a different one. It was a cheap one - only 99 cents - but if a lot of people are out 99 cents, that's a lot of dough. How do I get