Week Start Date from Week Number
How would I display the Week Start Date and Week Number for a range of dates.
required output:
weekno weekstartdate qty
11 8/03/04 50
12 15/3/04 100
13 22/3/04 75 etc
Do you have a start and end date and need it expanded to weeks ?
Let's say you have a table that include both the start and end dates
select to_char(ddate,'WW'), ddate
from (select start_dt + rownum - 1 ddate
from user_objects,
(select min( START_DATE ) as start_dt,
max( END_DATE ) as end_dt
from MY_TABLE
WHERE .... )
where start_dt + rownum <= end_dt ) a
where to_char(ddate,'D') = '1'
/Of course, one of the problems with WEEK is interpretation. Week one does not start until the First Sunday of the year. Which may or may not be what you want
Similar Messages
-
How to get the week start date from ISO week number
Hi,
I have a table with the following stucture
Year error Week1 week2 week3 ......week53
2012 error1 2 4 2 1
2012 error2 3 0 1 1I was hoping to get something like select year, error, week1||'Week start date which is a monday of that week' , week2||'Week start date,again monday',....week53 from table
Any suggestions please?
Thanks,
SunHi, Sun,
To see when week N started, add 7 * (N - 1) days to the beginning of the year. (By definition, the beginning of the ISO year is the start of week 1 of the ISO year.)
To see when week 22 of the current year started:
SELECT TRUNC (SYSDATE, 'IYYY') + (7 * (22 - 1))
FROM dual
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using.
See the forum FAQ {message:id=9360002} -
Dear experts,
i have day number and year ,i wanted to identify the date
ex: day number=203 year=2009
date:22/07/2009
please advice the best possible way to acheive this.
thanksFlorian:
Given that the OP said his fields were VARCHAR2, and his sample data showed leading zeroes, your original solution will work as posted. If the data had been numeric, another solution would be to just reverse the order of the components.
SQL> WITH t AS (
2 SELECT 2009 yr, 203 day_no FROM dual union all
3 SELECT 2006, 201 FROM dual union all
4 SELECT 1999, 99 FROM dual union all
5 SELECT 2000, 001 FROM dual union all
6 SELECT 1945, 100 FROM dual union all
7 SELECT 1921, 101 FROM dual)
8 SELECT TO_DATE(yr||day_no, 'yyyyddd') dt FROM t;
DT
22-JUL-2009
20-JUL-2006
09-APR-1999
01-JAN-2000
10-APR-1945
11-APR-1921It is the way that format masks are applied that causes his. With your mask and numeric iinput, it is taking the first 3 digits as the day number, in your example 902, then the remainder of them as the year, in your example 9. Obviously, the number of days in a year is never more than 366.
By reversing the mask, the first 4 digits are taken as the year, and the remainder are taken as the day number.
John -
Extract last date from DSO - Number ID through ABAP
Hi everyone.
I want to delete some records that i dont want to write to DSO through ABAP routine (transformation or DTP). For example, I am reading a number id and a date (yyyymmdd), but for that number I have many dates, and I wanna store the maximun date from all of them. For example:
ID Date
111 20111020
222 20111021
333 20111025
444 20111105
555 20111102
In DSO i want to store '444 20111105'. i tried this with a delta extraction , but the DSO receive any record. It seems the transformation read the DSO at random.
Appriciate your response
Thanks
IgnacioPerform a "selective delete".
Right click on DSO and goto Manage. Next, goto the Contents Tab. Then click on the selective delete button. This will ask you what criteria to use for the deletion. Enter your time restrictions and your'e good to go.
Cheers,
B -
Return the scheduled start date from one task to a custom field for all tasks
Hi all
I am trying populate an entire custom task date field with the scheduled start date of one of the tasks. I thought the easiest way would be to:
1) identify the date I need with a custom task flag field set to 'yes'
2) create a formula to look for the 'yes' flag in that field and populate the custom task date field with it.
This worked only for the task where the flag was set to yes (task #36) and the rest of the 49 tasks returned an error message. I'm unsure of how to set this up so that the date with the 'yes' flag populates in this column on
all 50 tasks.
This would also need to scale for situations where there were more or less than 50 tasks.
Thanks in advance...
Using MSP 2010 ProShelleyBrodie,
That's because the syntax of your formula isn't quite what you intend. The correct syntax is:
IIf( expression, truepart, falsepart )
For your case that converts to:
IIf([Flag1],[Scheduled Start],{not sure what you want for the false part but I assume is is not Scheduled Start})
Note, the "Yes" for Flag1 is implied, so the first part (i.e. Scheduled Start) is the truepart, but you don't give a value for the falsepart (i.e in both cases your formula is looking for Flag1 to be "yes". Let's say you want the Date1
field to have the Scheduled Start date if Flag1 is "yes" and to have today's date if Flag1 is "no". Then the formula will be:
IIf([Flag1],[Scheduled Start],[Current Date])
However, As I indicated in my previous response, you won't be able to do what you described in your initial post by using a formula. Are you now trying to do something different?
John -
Fetching data from a number of tables selected at runtime
Hi,
I have this application that stores user specific information on weekly basis. The application creates a new table every week and stores information in it on around 60 thousand users. The table structure is exactly the same for every week. Analytical reporting has to be done on this data which keeps on increasing every week. Views cannot be created as the reporting is dynamic and based on multiple tables which are in turn based on multiple time spans. For the same reason, the options to implement indexing and partitioning are ruled out. Is there an efficient way of doing it?
Thanking in anticipation,
MehwishHi
What is your question?
Do you want to separate the data by week but you don't want to change the queries? Use partitions. What is the problem with them?
Ott Karesz
http://www.trendo-kft.hu -
Logic to import data from n number of CSV to n number of tables dynamically
I have C:/source folder which would contain n of csv files.
Suppose, I have 2 CSV files in this folder
I need to select first CSV and put all records into first SQL table and then same for 2nd CSV (from 2nd CSV to 2nd table)
I don't know no of columns & column details of CSV.
How can we achieve it? which all tasks can we use?
Note: I tried to use for each task.. and DFT inside it.. but I am confused how to use destination table task
-Vaibhav ChaudhariHi Vaibhav,
The standard Data Flow Task supports only static metadata defined at runtime. What this means is that you have to create separate SSIS package for each CSV layout. This design is inefficient and requires more maintenance effort.
If you can use third-party solutions, I would recommend you check the commercial COZYROC
Data Flow Task Plus. It is an extension of the standard Data Flow Task with support for dynamic metadata at runtime. You can process source and destinations with different number of columns
and order. No programming skills are required.
SSIS Tasks Components Scripts Services | http://www.cozyroc.com/ -
How to connect start date of shape to start date from Excel column?
I tried to create Visio report with timeline
Created connections and add external data.
Dragged projects to the main screen
But, start/finish date do not connect to the project data.
What should I check or correct?The shape uses a custom property for the start and end date/time (controlled by the add-in).
Since you cannot have duplicate names for fields within the shape your spreadsheet's column name will have to be different than the solution name when it is read and linked. You might check David Parker's site for a possible solution.
http://blog.bvisual.net/
I remember him illustrating how to link a SharePoint list to a timeline for dynamic changes (roughly the same operation).
al
Al Edlund Visio MVP -
Pass on Guarantee Start Date from manufacturer to repairer
Dear Sap Gurs,
My Client has requirement that after expiration of manufacturer's guarantee, the repairer guarantee start and end dates should be updated in equipment master data.
In this case how to track both manufacturer's guarantee and repairer's guarantee .
Please suggest solution to map this process.
Regards
Kiran AmbiHi Kiran
As a standard, you can assign two warranties to an equipment:
Vendor Warranty and
Customer Warranty
So you can use Customer Warranty as Repair Warranty.
(see the attachment)
regards
Savas -
How to take the print out of the entire data from the waveform chart
i am using cont acq to spreadsheet file.vi to acquire data from a number of channels. this vi also plots the acquired data on the waveform chart. i want to take the print out of the entire data. how can i do it ?
also how can i take print out of the data between given interval??
please reply me
thank youThere are a number of different ways of achieving your goal. Depending on which version of LabVIEW you have and which development environment, the Report Generation Toolkit is a very powerful tool. Attached is an example that prints the acquired data without the use of additional toolkits.
Jonathan Hildyard
Applications Engineer
National Instruments
Attachments:
DAQ_with_Print.llb 115 KB -
Calculation of start date with backward scheduling
Dear all,
I am facing an issue related to backward scheduling. I have requirement in which whenever backward scheduling is used, system should calculate from last activity to first for calculation of schedules which is fine. But when running scheduling i am giving finish date as input and system is always using start date as current date and not calculation last date from last. For example if i input finish date as 15 feb 2015, and there is only one activity of 15 days, system should count start date from 1 feb 2015. Please help me how i can achieve this, currently its always putting start date as current date.
My current settings are--
Project definition- WBS Scheduling profile- Backward scheduling
scheduling scenario- Free scheduling
Network- Planning type- basic dates
Scheduling type- Backward
Please help.
ThanksDear all, this issue is resloved. Reason was that by default i am using forward scheduling for all project but in case of backward scheduling, user change schedule type at project definition and network. I was removing start date and putting finish date and running scheduling. Missing step from my side was i need to first copy date from top to down than run scheduling again.
Thanks. -
Active user report has different responsibility start date than inquiry for
hi,
I have a user for whom I see a different responsibliy start date in user inquiry form than what I see in Active user report for the same user.
Any idea why it is this way?
This tells me that inquiry forma and active users are pulling responsiblity start date from different place.
Please help this is a big problame for audit.Hi,
Please mention the application release.
Have you verified the value from the application (Security > User > Define)?
If possible, please post the query you use to get the start date.
Regards,
Hussein -
Extract data from database tables and download in pdf and csv
extract data from database tables and download in pdf and csv
hi how can i re-write my old form procedure in adf java. the procedure used to extract data from diffirent table and dowload the data in pdf and csv.am not downloading image, i what to extract data from diffirent tables in my database and download that data in pdf and csv. i would like to write this in java adf.i just what direction am not asking anyone to do my work this is my learning curve
the form code is
function merge_header3 return varchar2 is
begin
return '~FACILITY DESCRIPTION~ACCOUNT NO~BRANCH CODE~BANK REF NO.~P/P/ AMOUNT~Postal Address 1~Postal Address 2~Box Postal Code~Dep. Date~Month~BANK NAME~BRANCH NAME~ACCOUNT TYPE~DESCRIPTION~OBJECTIVE DESCRIPTION';
end;
procedure download_file (i_pbat integer) is
dir varchar2(80);
file_name1 varchar2(80);
file_name2 varchar2(80);
appl_code varchar2(80);
fil1 client_text_io.file_type;
fil2 client_text_io.file_type;
dat varchar2(1000);
DATA VARCHAR2(1000);
bvspro varchar2(100);
ssch varchar2(100);
bvspro_total number(20,2);
ssch_total number(20,2);
grand_total number(20,2);
cnt integer;
cursor pbat is
select *
from sms_payment_batches
where id = i_pbat
cursor pay (pb_id integer) is
select *
from sms_payment_vw
where pbat_id = pb_id
order by subsidy ASC,programme,beneficiary_name
cursor cgref (low varchar2) is
select *
from cg_ref_codes
where rv_domain ='SMS'
and rv_low_value = low
success boolean;
begin
set_application_property(cursor_style,'busy');
appl_code := sms_global.ref_code('SMS','APP_CODE','SMS',0);
dir := sms_global.ref_code('SMS','PAY_DIR','c:\sms\batch_payments',0);
success := webutil_file.create_directory(dir);
if webutil_file.file_is_directory(dir) then
null;
-- message ('directory exists');
else
-- message ('create directory ');
success := webutil_file.create_directory(dir);
-- if success then message ('directory exists'); end if;
end if;
for c_pbat in pbat loop
file_name1 := dir ||'\' || appl_code||c_pbat.batch_number||'-'||to_char(c_pbat.batch_dt,'yyyymmdd')||'pay.txt';
file_name2 := dir ||'\' || appl_code||c_pbat.batch_number||'-'||to_char(c_pbat.batch_dt,'yyyymmdd')||'merge.txt';
--message('create files ');
-- fil1 := client_text_io.fopen (file_name1,'W');
-- fil2 := client_text_io.fopen (file_name2,'W');
fil1 := client_text_io.fopen (file_name1,'W','');
fil2 := client_text_io.fopen (file_name2,'W','');
dat := 'FROM ACCOUNT NUMBER'
||'~'||'FROM ACCOUNT DESCRIPTION'
||'~'||'MY STATEMENT DESCRIPTION'
||'~'||'BENEFICIARY ACCOUNT NUMBER'
||'~'||'BENEFICIARY SUB ACCOUNT NUMBER'
||'~'||'BENEFICIARY BRANCH CODE'
||'~'||'BENEFICIARY NAME'
||'~'||'BENEFICIARY STATEMENT DESCRIPTION'
||'~'||'AMOUNT';
-- client_text_io.put_line(fil1,dat);
bvspro:= null;
ssch := null;
cnt := 0;
dat := '~'||lpad('~',16,'~');
for c_pay in pay(c_pbat.id) loop
--message('cpay loop ' || cnt);
if bvspro is null then
dat := lpad('~',16,'~');
dat := utility.put_field(1,c_pay.programme,dat,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,c_pay.subsidy,dat,'~');
client_text_io.put_line(fil2,dat);
dat := merge_header3;
client_text_io.put_line(fil2,dat);
bvspro := c_pay.programme;
ssch := c_pay.subsidy;
grand_total := 0;
bvspro_total := 0;
ssch_total := 0;
end if;
if bvspro <> c_pay.programme then
dat := lpad('~',16,'~');
dat := utility.put_field(5,ssch_total,dat,'~');
dat := lpad('~',16,'~');
dat := utility.put_field(5,bvspro_total,dat,'~');
dat := utility.put_field(1,'Total:' || bvspro,dat,'~');
client_text_io.put_line(fil2,dat);
dat := lpad('~',16,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,c_pay.programme,dat,'~');
client_text_io.put_line(fil2,dat);
bvspro := c_pay.programme;
dat := utility.put_field(1,c_pay.subsidy,dat,'~');
client_text_io.put_line(fil2,dat);
dat := merge_header3;
client_text_io.put_line(fil2,dat);
bvspro := c_pay.programme;
ssch := c_pay.subsidy;
bvspro_total := 0;
ssch_total := 0;
cnt :=0;
end if;
if ssch <> c_pay.subsidy then
dat := lpad('~',16,'~');
dat := utility.put_field(5,ssch_total,dat,'~');
dat := lpad('~',16,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,c_pay.subsidy,dat,'~');
client_text_io.put_line(fil2,dat);
dat := merge_header3;
client_text_io.put_line(fil2,dat);
ssch := c_pay.subsidy;
ssch_total := 0;
cnt :=0;
end if;
bvspro_total := bvspro_total + c_pay.amount;
ssch_total := ssch_total + c_pay.amount;
grand_total := grand_total + c_pay.amount;
cnt := cnt +1;
--message('bfore write file 2 ' );
client_text_io.put_line(fil2
,cnt
||'~'|| c_pay.beneficiary_name
||'~'||c_pay.BENEFICIARY_ACCOUNT_NUMBER ||''
||'~'||c_pay.BRANCH_CODE ||''
||'~'|| c_pay.BENEFICIARY_STATEMENT_DESC
||'~'|| c_pay.AMOUNT
||'~'|| c_pay.address_line1
||'~'|| c_pay.address_line2
||'~'|| c_pay.postal_code
||'~'|| TO_CHAR(c_pay.deposit_date,'DD-Mon-YYYY')
||'~'|| c_pay.month
||'~'|| c_pay.bank
||'~'|| c_pay.bank_branch
||'~'|| c_pay.account_type
||'~'|| c_pay.subsidy
||'~'|| c_pay.programme)
DATA := c_pay.FROM_ACCOUNT_NUMBER
||'~'||c_pay.FROM_ACCOUNT_DESCR
||'~'||c_pay.MY_STATEMENT_DESCR
||'~'||c_pay.BENEFICIARY_ACCOUNT_NUMBER
||'~'
||'~'||c_pay.BRANCH_CODE
||'~'||c_pay.BENEFICIARY_NAME
||'~'||c_pay.BENEFICIARY_STATEMENT_DESC
||'~'||c_pay.AMOUNT;
DATA := REPLACE(DATA, ',' , ' ' );
DATA := REPLACE(DATA, '~' , ',' );
--message (cnt ||' ' || data);
--message('bfore write file 1 ' );
client_text_io.put_line(fil1, data);
end loop;
--message ('end of write');
dat := lpad('~',16,'~');
dat := utility.put_field(6,ssch_total,dat,'~');
dat := lpad('~',16,'~');
dat := utility.put_field(1,'Total:' || bvspro,dat,'~');
dat := utility.put_field(5,bvspro_total,dat,'~');
client_text_io.put_line(fil2,dat);
dat := lpad('~',16,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,'Grand Total:' ,dat,'~');
dat := utility.put_field(5,grand_total,dat,'~');
client_text_io.put_line(fil2,dat);
-- close file
for i in 1..50 loop
if substr(i,-1) = 0 then
message ('flush ' || i);
end if;
client_text_io.put_line(fil1, lpad(' ',2000));
client_text_io.put_line(fil2, lpad(' ',2000));
client_text_io.put_line(fil1, lpad(' ',2000));
client_text_io.put_line(fil2, lpad(' ',2000));
end loop;
client_text_io.fclose(fil1);
client_text_io.fclose(fil2);
end loop;
set_application_property(cursor_style,'default');
exception
when others then
message(sqlcode ||' ' ||sqlerrm);
end download_file; i try this but this code onlydownload image not data from database tables
public void downloadImage(FacesContext facesContext, OutputStream outputStream)
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
// get an ADF attributevalue from the ADF page definitions
AttributeBinding attr = (AttributeBinding) bindings.getControlBinding("DocumentImage");
if (attr == null)
return;
// the value is a BlobDomain data type
BlobDomain blob = (BlobDomain) attr.getInputValue();
try
{ // copy the data from the BlobDomain to the output stream
IOUtils.copy(blob.getInputStream(), outputStream);
// cloase the blob to release the recources
blob.closeInputStream();
// flush the output stream
outputStream.flush();
catch (IOException e)
// handle errors
e.printStackTrace();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), "");
FacesContext.getCurrentInstance().addMessage(null, msg);
}You should ask your forum in the ADF-forum.
-
Run a formula if a cell contains particular data from various cells
I have a formula which checks a list of domains to see what the TLD is and then returns a renewal price based on the TLD e.g. .co.uk may return with $5.99 and .com $10.00. The formula I am using is below:
=VLOOKUP(RIGHT(A2,LEN(A2)−SEARCH(".",A2)+1),$A:$B,2,FALSE)
I am now wanting to expand this formula to check additional criteria before running the above formula.
I don't know what functions to use, but I know what I'm trying to achieve, so please, humour me when it comes to make believe syntax below:
if a cell contains the data from a number of cells e.g. C$2:C$5 then run the above formula, if not return "N/A"Hi Ian,
Thanks for your reply.
I see exactly where you're going with this, but it's not exactly what I'm after.
Perhaps I need to be a bit more clear in my explanation - my bad.
Cell A2 has a domain name e.g. example.com, example.co.uk, example.org, example.net
Cell B2 has a number of options to choose from e.g. Expire, Hosting, Backorder, Mapping
Column D2:D5 have a number of TLDs e.g. co.uk, .com, .org, .net
Column E2:E5 have the corresponding annual renewal prices for the TLDs listed in cells F2:F5
Column F2:F5 have the options than can be chosen in column B2
I only want to get the renewal price for the TLD where the option in Cell B2 is one of the options listed in cells F2:F5 and if it's not, I want it to return "N/A" -
BG_ABSENCE_DURATION FF start date issue
Hi
I have created BG_ABSENCE_DURATION fast formula with the effective start date as "01-DEC-2009" by mistake. It has to be from 01-JAN-2001. If I try to delete the existing one, it is showing message that, you cannot delete the Quickpaint Type fast formula. How could I change the effective date of this fast formula to 01-JAN-2001 ?
Thanks in advance.Update the Effective Start Date from the backend.
Or you will need to delete the Formula from backend. You need to clear following tables.
FF_COMPILED_INFO_F
FF_FDI_USAGES_F
FF_FORMULAS_F_TL
FF_FORMULAS_F
Maybe you are looking for
-
Why is there a message saying that my apple id has not yet been used in the itunes store? i just registered
-
Premiere PPJs not opening after
After upgrading to the latest version of Adobe CC today I cannot open any of my project files. I tried a suggested solution: Error "...a sequence that could not be opened" 1. It doesn't make sense because there is no "Deactivate" button under the Hel
-
I just pulled the new gentoo package from the repositories. So far, it appears to work, but I keep on getting the followign msgs printed to the console whenever I run it: ** WARNING **: Couldn't initialize mount data - automounting won't work ** WARN
-
Why do I keep getting a quicktime run error -50 when I try to share my video?
Why do I keep getting a quicktime run error-50 when I try to share a video?
-
HELP: scheduled jobs no run---searched a lot but still cannot resolve
As for this problem, I have searched a lot by google, but I still cannot resolve it. I am using 11g on Linux. I delete all of jobs in my database.Then I configured a very simple periodic job as follows: begin DBMS_SCHEDULER.create_job (job_name => 't