Loop Through Date Range
Hi guys,
I have date range as parameter like 01/JAN/2009 TO 16/JAN/2009 now i want to loop through this date range and want to get date like
01/JAN/2009,02/JAN/2009.....16/JAN/2009.how can i achive this ?
Thanks
Ron
Hi,
What do you mean by loop through?
SQL> with dates as (select to_date('01/JAN/2009', 'dd/mm/yyyy') start_date
,to_date('16/JAN/2009', 'dd/mm/yyyy') end_date from dual)
select start_date + level - 1 from dates connect by level <= end_date - start_date + 1
START_DATE
01/01/2009
02/01/2009
03/01/2009
04/01/2009
05/01/2009
06/01/2009
07/01/2009
08/01/2009
09/01/2009
10/01/2009
11/01/2009
12/01/2009
13/01/2009
14/01/2009
15/01/2009
16/01/2009
16 rows selected.Regards
Peter
Similar Messages
-
How do I go about this? Creating table while looping through dates?
How do I do this? Creating table while looping through dates?
I have a table with information like:
ID---Date---Status
1-------04/23-----Open
1-------04/25-----Open
2-------04/24-----Closed
3-------04/26-----Closed
What I want to do is create another table based on this per ID, but have all the dates/statuses on the same line as that ID number (as additional columns). The problem is that the number of columns needed is to be dynamically decided by the number of dates.
To illustrate my example, I'm looking to achieve the following:
ID---04/23 Status---04/24--Status---04/25--Status---04/26--Status
1----Open--------------<null>-------------Open---------------<null>
2----<null>------------Closed-------------<null>-------------<null>
3----<null>------------<null>-------------<null>-------------Closed
What would be the best way to go about this?
Can someone please point me in the right direction?
Would I need to do some looping?
Thanks in advance!thedunnyman wrote:
How do I do this? Creating table while looping through dates?
I have a table with information like:
ID---Date---Status
1-------04/23-----Open
1-------04/25-----Open
2-------04/24-----Closed
3-------04/26-----Closed
What I want to do is create another table based on this per ID, but have all the dates/statuses on the same line as that ID number (as additional columns). The problem is that the number of columns needed is to be dynamically decided by the number of dates.
To illustrate my example, I'm looking to achieve the following:
ID---04/23 Status---04/24--Status---04/25--Status---04/26--Status
1----Open--------------<null>-------------Open---------------<null>
2----<null>------------Closed-------------<null>-------------<null>
3----<null>------------<null>-------------<null>-------------Closed
What would be the best way to go about this?
Can someone please point me in the right direction?
Would I need to do some looping?
Thanks in advance!I hope you are asking about writing a query to DISPLAY the data that way ... not to actually create such a massively denormalized table .... -
Hi guys
I have this set of numbers. 54 55 56 58 59 61 64 66. I want to loop through this set of number to give an array of result of 54 55 56 0 58 59 0 61 0 0 64 0 66.
Simply, i am trying to insert zero into the blank of the +1 interval in this set of number. I could not figure out how to do this.
Please help me thank you
Cheers
PX
Solved!
Go to Solution.Hi pengxin,
see the attached image.
Mike
Attachments:
Insert0.PNG 8 KB -
How to loop through dates using For Loop?
Hi All,
I assume the For Loop is the best way to loop through days in a date range, but I can't figure out how to add a day in the "AssignExpression" box. The following gets the errors "The expression contains unrecognized token 'DAY'",
and "Attempt to parse the expression 'DATEADD(DAY, 1, @CounterPlayer)' failed and returned error code 0xC00470A4."
InitExpression: @CounterPlayer = @DownloadFileDatePlayer
EvalExpression: @CounterPlayer <= @Today
AssignExpression: @CounterPlayer = DATEADD(DAY, 1, @CounterPlayer)
I need to step through days, not through files. What am I doing wrong here? I changed "DAY" to "Day," but that didn't fix it.
Thanks,
EricDOH! It just needed properly placed quotes. Here's the answer:
AssignExpression: @CounterPlayer = DATEADD("DAY", 1, @CounterPlayer) -
How to loop through data of ALV grid in Webdynpro for Abap view
hello,
I have a view with an ALV component(SALV_WD_TABLE). I just want to loop through the lines shown (particularly when the user has set filter).
Can you help me to find how to reach the internal table ?
In summary, I want to know the reverse method of BIND_TABLE()
Thanks!Not really...
Here is the solution :
DATA lo_ui TYPE if_salv_wd_table=>s_type_param_get_ui_info.
lo_ui = lo_interfacecontroller->get_ui_info( ).
DATA: lt_displayed TYPE salv_bs_t_int,
li_displayed TYPE int4.
lt_displayed = lo_ui-t_displayed_elements.
check not lt_displayed is initial.
loop at lt_displayed into li_displayed.
Regards -
How to loop through dates and return a list of dates?
hi,
thank you all for your help my all my oracle endaevors so far:)
I was going through PL/SQL Programming book by Oracle Press, but overall wasnt able to find the answer for the following.
I have a list of shops, simple: shop_name (table), date_holiday (table) that lets me keep dates that certain shop is closed.
example: shopID = 10
shopID 10
date_holiday 12/31/2009
shopID 10
date_holiday 1/1/2009
now, what I am trying to achieve is I am trying to get the list of days (formatted as MM/DD/YYYY, but thats not biggy) starting today and ending up in 3 months from now that will EXCLUDE all the holidays, example
select date_open ...... where shopID = 10;
[starting today]
12/29/2009
12/30/2009
1/2/2010
1/3/2010
[ending 3 months from today]
any simple ways or ideas that may help?
thank you!somehow like this
select :the_shop shopid,the_day date_open
from (select the_day,date_holiday
from (select trunc(sysdate) + level the_day
from dual
connect by level <= add_months(trunc(sysdate),3) - trunc(sysdate)
) d,
(select date_holiday
from holday_table
where shopid = :the_shop
) h
where the_date = date_holiday(+)
(select nvl2(location_open1,'open,','mon,')||
nvl2(location_open2,'open,','tue,')||
nvl2(location_open3,'open,','wed,')||
nvl2(location_open4,'open,','thu,')||
nvl2(location_open5,'open,','fri,')||
nvl2(location_open6,'open,','sat,')||
nvl2(location_open7,'open,','sun') location_not_open
from locations
where locationid = (select shopid
from shops
where shopid = :the_shop
where instr(location_not_open,to_char(the_day,'dy')) = 0
or date_holiday is nullRegards
Etbin -
Looping through date column - Summing hours per day
All,
Running the query below against my timesheet tables I get the following results:
-----SQL CODE------
SELECT
ts.ts_date Date,
ts.user_name Name,
tc.account Account,
ts.no_of_hrs Hours,
SUM(ts.no_of_hrs) OVER(PARTITION BY ts.ts_date) Daily_Total
FROM
eba_time_timesheet ts,
eba_time_timecodes tc
WHERE
ts.timecode_id = tc.id AND
ts.user_name LIKE 'JohnD'
ORDER BY
1
-----RESULTS-------
Date Name Account Hours Daily Total
1-Dec-09 JOHND 489310 1.5 8
1-Dec-09 JOHND 486830 1.5 8
1-Dec-09 JOHND 481710 3 8
1-Dec-09 JOHND 481210 0.5 8
1-Dec-09 JOHND 486840 0.5 8
1-Dec-09 JOHND 485710 0.5 8
1-Dec-09 JOHND 481010 0.5 8
2-Dec-09 JOHND 481710 1 8
2-Dec-09 JOHND 485710 7 8
3-Dec-09 JOHND 481710 6 8
3-Dec-09 JOHND 488810 1.5 8
3-Dec-09 JOHND 481310 0.5 8
4-Dec-09 JOHND 489710 8 8
7-Dec-09 JOHND 481110 0.5 8
7-Dec-09 JOHND 489710 7 8
7-Dec-09 JOHND 481210 0.5 8
However, I would prefer the Daily Total column be a row in the results instead of a column. Here is an example of how I would prefer the results. This statement will then be sent to a calendar for each user to see there time for each account and total time per day.
Date Name Account Hours
1-Dec-09 JOHND 489310 1.5
1-Dec-09 JOHND 486830 1.5
1-Dec-09 JOHND 481710 3
1-Dec-09 JOHND 481210 0.5
1-Dec-09 JOHND 486840 0.5
1-Dec-09 JOHND 485710 0.5
1-Dec-09 JOHND 481010 0.5
*1-Dec-09 JOHND Daily Total 8*
2-Dec-09 JOHND 481710 1
2-Dec-09 JOHND 485710 7
*2-Dec-09 JOHND Daily Total 8*
3-Dec-09 JOHND 481710 6
3-Dec-09 JOHND 488810 1.5
3-Dec-09 JOHND 481310 0.5
*3-Dec-09 JOHND Daily Total 8*
4-Dec-09 JOHND 489710 8
*4-Dec-09 JOHND Daily Total 8*
7-Dec-09 JOHND 481110 0.5
7-Dec-09 JOHND 489710 7
7-Dec-09 JOHND 481210 0.5
*7-Dec-09 JOHND Daily Total 8*
Any help would be greatly appreciated.
This is my 1st post so if I've left something out or you need additional info please let me know.
I’m using Oracle 10guser9160575 wrote:
Thanks for all the input! I ended up using the GROUP BY ROLLUP and adding a CASE statement for inserting "DAILY TOTAL" in the account column.If you are on at least 10g, model solution could be simpler:
with t as (
select to_date('1-Dec-09','dd-mon-yy') dt,'JOHND' name,489310 account,1.5 hours,8 daily_total from dual union all
select to_date('1-Dec-09','dd-mon-yy'),'JOHND',486830,1.5,8 from dual union all
select to_date('1-Dec-09','dd-mon-yy'),'JOHND',481710,3,8 from dual union all
select to_date('1-Dec-09','dd-mon-yy'),'JOHND',481210,0.5,8 from dual union all
select to_date('1-Dec-09','dd-mon-yy'),'JOHND',486840,0.5,8 from dual union all
select to_date('1-Dec-09','dd-mon-yy'),'JOHND',485710,0.5,8 from dual union all
select to_date('1-Dec-09','dd-mon-yy'),'JOHND',481010,0.5,8 from dual union all
select to_date('2-Dec-09','dd-mon-yy'),'JOHND',481710,1,8 from dual union all
select to_date('2-Dec-09','dd-mon-yy'),'JOHND',485710,7,8 from dual union all
select to_date('3-Dec-09','dd-mon-yy'),'JOHND',481710,6,8 from dual union all
select to_date('3-Dec-09','dd-mon-yy'),'JOHND',488810,1.5,8 from dual union all
select to_date('3-Dec-09','dd-mon-yy'),'JOHND',481310,0.5,8 from dual union all
select to_date('4-Dec-09','dd-mon-yy'),'JOHND',489710,8,8 from dual union all
select to_date('7-Dec-09','dd-mon-yy'),'JOHND',481110,0.5,8 from dual union all
select to_date('7-Dec-09','dd-mon-yy'),'JOHND',489710,7,8 from dual union all
select to_date('7-Dec-09','dd-mon-yy'),'JOHND',481210,0.5,8 from dual
select dt "Date",
name "Name",
account "Account",
hours "Hours"
from t
model
dimension by(dt,name,to_char(account) account)
measures(hours,daily_total,0 seq)
rules upsert all(
hours[any,any,'Daily Total'] = max(daily_total)[cv(dt),cv(name),any],
seq[any,any,'Daily Total'] = 1
order by dt,
name,
seq,
account
Date Name Account Hours
01-DEC-09 JOHND 481010 .5
01-DEC-09 JOHND 481210 .5
01-DEC-09 JOHND 481710 3
01-DEC-09 JOHND 485710 .5
01-DEC-09 JOHND 486830 1.5
01-DEC-09 JOHND 486840 .5
01-DEC-09 JOHND 489310 1.5
01-DEC-09 JOHND Daily Total 8
02-DEC-09 JOHND 481710 1
02-DEC-09 JOHND 485710 7
02-DEC-09 JOHND Daily Total 8
Date Name Account Hours
03-DEC-09 JOHND 481310 .5
03-DEC-09 JOHND 481710 6
03-DEC-09 JOHND 488810 1.5
03-DEC-09 JOHND Daily Total 8
04-DEC-09 JOHND 489710 8
04-DEC-09 JOHND Daily Total 8
07-DEC-09 JOHND 481110 .5
07-DEC-09 JOHND 481210 .5
07-DEC-09 JOHND 489710 7
07-DEC-09 JOHND Daily Total 8
21 rows selected.
SQL> SY. -
Nested Loops...looping through one month of data at a time year by year
Hi all,
I'm trying to create an insert statement that loops through a table that has 10 years of data (2001 to 2010) month by month to minimize impact on server and commits more frequently to avoid filling up the redo logs and rollback tablespaces. The table is large, has about 40 millions records per year. Lets say the structure of the table is the following:
Customer_ID number(9),
Order_Item_1 number(6),
Order_Item_2 number(6),
Order_Item_3 number(6),
Order_date date
The table is in flat format but I want to normalize it so that it looks like the following:
Customer_ID Order_Seq Order_Item Order_date
999999999 1 555555 01-jan-2001
999999999 2 666666 01-jan-2001
999999999 3 444444 01-jan-2001
888888888 1 555555 03-jan-2001
888888888 2 666666 03-jan-2001
But because I want to loop through month by month....I need to set it up so that it loops through month by month, year by year (Using the Order Date Field) and Order_item by Order_item. Something like:
so my insert statements would be something like if I hardcoded instead of put the insert statement into a loop:
insert into orders_normalized
(Customer_id,Order_seq,Order_item,Order_date) select customer_id,1,Order_item,Order_date where Order_item_1 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='01';
insert into orders_normalized
(Customer_id,Order_seq,Order_item,Order_date) select customer_id,2,Order_item,Order_date where Order_item_2 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='01';
insert into orders_normalized
(Customer_id,Order_seq,Order_item,Order_date) select customer_id,3,Order_item,Order_date where Order_item_3 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='01';
insert into orders_normalized
(Customer_id,Order_seq,Order_item,Order_date) select customer_id,1,Order_item,Order_date where Order_item_1 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='02';
insert into orders_normalized
(Customer_id,Order_seq,Order_item,Order_date) select customer_id,2,Order_item,Order_date where Order_item_2 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='02';
insert into orders_normalized
(Customer_id,Order_seq,Order_item,Order_date) select customer_id,3,Order_item,Order_date where Order_item_3 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='03';
Hope this makes sense.
ThanksDoes the sequence of items in an order really matter? In other words, do we really need to preserve that an item was in position 2 versus position 1? I bet that the sequence or position of each item in an order is not meaningful. They were probably numbered 1, 2, and 3 just to make them uniquely named columns so there would be three slots to hold up to 3 items in the denormalized table.
You only have about 400 million rows to insert, so it could feasibly be done in a single transaction (depending on your database environment).
You can always do a create table as select (CTAS) to help with undo / redo issues and get better performance. You could run it in parallel, and spit it out to a new table partitioned by month. Single DDL statement running in parallel making your new table--sounds good to me.
How about something like this:
CREATE TABLE ORDERS_NORMALIZED
(CUSTOMER_ID, ORDER_ITEM, ORDER_DATE)
PARTITION BY RANGE(ORDER_DATE)
PARTITION p200901 VALUES LESS THAN (TO_DATE('200902','YYYYMM')),
PARTITION p200902 VALUES LESS THAN (TO_DATE('200903','YYYYMM')),
PARTITION p201012 VALUES LESS THAN (TO_DATE('201101','YYYYMM'))
as SELECT CUSTOMER_ID, ORDER_ITEM_1, ORDER_DATE
FROM OTHER_TABLE
WHERE ORDER_ITEM_1 IS NOT NULL
UNION ALL
SELECT CUSTOMER_ID, ORDER_ITEM_2, ORDER_DATE
FROM OTHER_TABLE
WHERE ORDER_ITEM_2 IS NOT NULL
UNION ALL
SELECT CUSTOMER_ID, ORDER_ITEM_3, ORDER_DATE
FROM OTHER_TABLE
WHERE ORDER_ITEM_3 IS NOT NULL.....................
Out of curiosity, why not normalize it further? You could have used two tables instead of one.
One (ORDER) with:
ORDER_ID
CUSTOMER_ID
DATE
Order_id would be a new surrogate key / primary key.
Another table (ORDER_ITEM) with:
ORDER_ID
ORDER_ITEM
It would be a table that links ORDERS to ITEMS. You get the idea. -
Automator - Loop through a text file and process data through a 3rd party software
Just stumbled on Automator the other day (I am a mac n00b) and would like to automate the processing of a text file, line-by-line, using a third party tool. I would like Automator to loop through the text file one line at a time, copy the string and keep as a variable. Next, place the variable data (copied string) into the text field of the 3rd party software for processing. Once the processing is complete, I would like Automator to fetch the next line/string for processing. I see items like "copy from clipboard" and "variables" within the menu but I am not finding much documentation on how to utilizle this tool. Just hear how potentially powerful it is.
The 3rd party software is not a brand name, just something made for me to process text. I may have to use mouse clicks or tabs + [return] to navigate with Automator. A term I heard on Bn Walldie's itunes video series was "scriptable software" for which I don't think this 3rd party app would be.
Kind regards,
jwGood news and bad news...
The good news is that it should be entirely possible to automate your workflow.
The bad news is that it will be a nightmare to implement via Automator, if it's even possible.
Automator is, essentially a pretty interface on top of AppleScript/Apple Events, and with the pretty interface comes a certain stranglehold on features. Knowing how to boil rice might make you a cook, but understanding flavor profiles and ingredient combinations can make you a chef, and it's the same with AppleScript and Automator. Automator's good at getting you from points A to B but if there are any bumps in the road (e.g. the application you're using isn't scriptable) then it falls apart.
What I'm getting at is that your requirements are pretty simple to implement in AppleScript because you can get 'under the hood' and do exactly what you want, as opposed to Automator's restricted interface.
The tricky part is that if no one else can see this app it's going to be hard to tell you what to do.
I can give you the basics on reading a file and iterating through the lines of text in it, and I can show you how to 'type' text in any given application, but it may be up to you to put the pieces together.
Here's one way of reading a file and working through each line of text:
-- ask the user for a file:
set theFile to (choose file)
-- read the file contents:
set theFileContents to (read file theFile)
-- break out the lines/paragraphs of text:
set theLines to paragraphs of theFileContents
-- now iterate through those lines, one by one:
repeat with eachLine in theLines
-- code to perform for eachLine goes here
end repeat
Once you have a line of text (eachLine in the above example) you can 'type' that into another application via something like:
tell application "AppName" to activate
tell application "System Events"
tell process "AppName"
keystroke eachLine
end tell
end tell
Here the AppleScript is activating the application and using System Events to emulate typing the contents of the eachLine variable into the process. Put this inside your repeat loop and you're almost there. -
How to loop through XML data in a table of XMLType?
Hi,
I am failry new to xml document processing in Oracle using PL/SQL.
My DB version: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
I have successfully loaded an xml document into a table using the following two statements:
1) CREATE TABLE mytable2 OF XMLType;
2) INSERT INTO mytable2 VALUES (XMLType(bfilename('IMAGE_FILE_LOC', 'IFTDISB20100330172157C002.xml'), nls_charset_id('AL32UTF8')));
Now I need to traverse through the various nodes within the xml document and extract values of elements of each node. The question I have is:
How do I loop through a node? A VALID record is enclosed within the <checkItem> </checkItem> tags.
Here is a snippet of the data in that xml document:
++++++++++++++++++++++++++++++++++++++++++++++++
<?xml version="1.0" encoding="UTF-8"?>
<bdiData>
<documentControlInfo>
<documentInfo>
<docDescription>Check images and data for Test Company, account number 1234567890</docDescription>
<docID>
<ID>20100330172157</ID>
</docID>
<docModifier>Test Company</docModifier>
<docCreateDate>2010-03-30</docCreateDate>
<docCreateTime>17:21:57-0700</docCreateTime>
<standardVersion>1.0</standardVersion>
<testIndicator>0</testIndicator>
<resendIndicator>0</resendIndicator>
</documentInfo>
<sourceInfo>
<sourceName>The Bank IFT</sourceName>
<sourceID>
<idOther>TheBankIFT</idOther>
</sourceID>
</sourceInfo>
<destinationInfo>
<destinationName>Test Company</destinationName>
<destinationID>
<idOther>FEI3592</idOther>
</destinationID>
</destinationInfo>
</documentControlInfo>
<checkItemCollection>
<collectionInfo>
<description>Items</description>
<ID>1269994919135</ID>
<Classification>
<classification>Items</classification>
</Classification>
</collectionInfo>
<checkItemBatch>
<checkItemBatchInfo>
<description>Paid Checks</description>
<ID>1269994919135</ID>
<Classification>
<classification>Paid Checks</classification>
</Classification>
</checkItemBatchInfo>
<checkItem>
<checkItemType>check</checkItemType>
<checkAmount>86468</checkAmount>
<postingInfo>
<date>2010-03-29</date>
<RT>10700543</RT>
<accountNumber>1234567890</accountNumber>
<seqNum>009906631032</seqNum>
<trancode>001051</trancode>
<amount>86468</amount>
<serialNumber>300040647</serialNumber>
</postingInfo>
<totalImageViewsDelivered>2</totalImageViewsDelivered>
<imageView>
<imageIndicator>Actual Item Image Present</imageIndicator>
<imageViewInfo>
<Format>
<Baseline>TIF</Baseline>
</Format>
<Compression>
<Baseline>CCITT</Baseline>
</Compression>
<ViewSide>Front</ViewSide>
<imageViewLocator>
<imageRefKey>201003260000738400851844567205_Front.TIF</imageRefKey>
<imageFileLocator>IFTDISB20100330172157M002.zip</imageFileLocator>
</imageViewLocator>
</imageViewInfo>
<imageViewInfo>
<Format>
<Baseline>TIF</Baseline>
</Format>
<Compression>
<Baseline>CCITT</Baseline>
</Compression>
<ViewSide>Rear</ViewSide>
<imageViewLocator>
<imageRefKey>201003260000738400851844567205_Rear.TIF</imageRefKey>
<imageFileLocator>IFTDISB20100330172157M002.zip</imageFileLocator>
</imageViewLocator>
</imageViewInfo>
</imageView>
</checkItem>
<checkItem>
<checkItemType>check</checkItemType>
<checkAmount>045</checkAmount>
<postingInfo>
<date>2010-03-29</date>
<RT>10700543</RT>
<accountNumber>1234567890</accountNumber>
<seqNum>008518967429</seqNum>
<trancode>001051</trancode>
<amount>045</amount>
<serialNumber>200244935</serialNumber>
</postingInfo>
<totalImageViewsDelivered>2</totalImageViewsDelivered>
<imageView>
<imageIndicator>Actual Item Image Present</imageIndicator>
<imageViewInfo>
<Format>
<Baseline>TIF</Baseline>
</Format>
<Compression>
<Baseline>CCITT</Baseline>
</Compression>
<ViewSide>Front</ViewSide>
<imageViewLocator>
<imageRefKey>201003290000713900851896742901_Front.TIF</imageRefKey>
<imageFileLocator>IFTDISB20100330172157M002.zip</imageFileLocator>
</imageViewLocator>
</imageViewInfo>
<imageViewInfo>
<Format>
<Baseline>TIF</Baseline>
</Format>
<Compression>
<Baseline>CCITT</Baseline>
</Compression>
<ViewSide>Rear</ViewSide>
<imageViewLocator>
<imageRefKey>201003290000713900851896742901_Rear.TIF</imageRefKey>
<imageFileLocator>IFTDISB20100330172157M002.zip</imageFileLocator>
</imageViewLocator>
</imageViewInfo>
</imageView>
</checkItem>
<checkItemBatchSummary>
<totalItemCount>1028</totalItemCount>
<totalBatchAmount>61370501</totalBatchAmount>
<totalBatchImageViewsDelivered>2056</totalBatchImageViewsDelivered>
</checkItemBatchSummary>
</checkItemBatch>
<collectionSummary>
<totalBatchCount>1</totalBatchCount>
<totalItemCount>1028</totalItemCount>
<totalCollectionAmount>61370501</totalCollectionAmount>
<totalCollectionImageViewsDelivered>2056</totalCollectionImageViewsDelivered>
</collectionSummary>
</checkItemCollection>
<documentSummaryInfo>
<totalCollectionCount>1</totalCollectionCount>
<totalBatchCount>1</totalBatchCount>
<totalItemCount>1028</totalItemCount>
<totalDocumentAmount>61370501</totalDocumentAmount>
<totalDocumentImageViewsDelivered>2056</totalDocumentImageViewsDelivered>
</documentSummaryInfo>
</bdiData>
++++++++++++++++++++++++++++++++++++++++++++++++
Any ideas and or suggestions will be greatly appreciated.
Cheers!
Edited by: user12021655 on Aug 3, 2010 1:25 PMI really need to update my blog to get the example you are looking for posted. I did a quick search on the forums for XMLTable and found a good example at {message:id=4325701}. You will want to use OBJECT_VALUE in the PASSING clause where you need to reference the column in your table.
Note: See the FAQ in the upper right for how to use the tag to wrap objects to retain formatting. Also your XML is missing closing nodes. -
How to loop through a Data Node
Hello,
I have an Interactive Adobe form in WebDynpro Java project.
My data View tab includes the following structure:
Bapi_test
ValueHelpData
CodeNumber
CodeDescription
Can someone please tell how I can loop through the ValueHelpData node, and get values for CodeNumber and CodeDescription
The ValueHelpData node has the cardinality of 0..n. and has approximately 100 elements.
Thanks. Your help is much appreciated.
Rob.Hi Robby,
You could try the following :
int n = wdContext.nodeValueHelpData().size();
for(int i = 0; i < n; i++)
wdContext.nodeValueHelpData().moveTo(i);
IPrivateMyDataView.IValueHelpDataElement ele = wdContext.currentValueHelpDataElement();
String codenum = ele.getCodeNumber();
String codedesc = ele.getCodeDescription();
// Any other processing logic..//
Hope this helps. -
Loop through tables based on data dict values
Hi,
I working on an old v7.3.4 database that I'm not familiar with and I want to loop through the tables and count the occurrence of a field value based on table names i've retrieved from the data dictionary. None of the tables have relational keys defined.
In a cursor I can loop thru all_tab_columns and load variables with the table, column names, and the datatype, but then I want to use these values in a second nested cursor to loop through each table found by the first cursor.
When I do :
Select var_colname from var_tabname
i get
The following error has occurred:
ORA-06550: line 23, column 10:
PLS-00356: 'V_TABNAME' must name a table to which the user has access
ORA-06550: line 22, column 5:
PL/SQL: SQL Statement ignored
ORA-06550: line 22, column 12:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 27, column 7:
PL/SQL: SQL Statement ignored
so it would seem I can't use a variable to substitute the table name in the 'from' clause. Does anyone know of a way round this ?
Thanks in advanceHi,
You will have to use dynamic sql to create your second cursor.
DECLARE
v_sql_query VARCHAR2(400);
TYPE cur_typ IS REF CURSOR;
c1 cur_typ;
mYRec MyTable%rowtype;
BEGIN
v_sql_query := 'select * from MyTable';
OPEN c1 FOR v_sql_query;
LOOP
FETCH c1 INTO mYRec;
EXIT WHEN c1%NOTFOUND;
EXIT WHEN c1%NOTFOUND IS NULL;
/*processing here*/
END LOOP;
CLOSE c1;
END;
Regards -
Loop through all items in all data blocks?
Is there a way to loop through every item in every data block and set the property of a format mask?
I do not know what error it is, only that an on-error trigger fires.
I found out one thing I was definitely doing wrong, using nextblock, nextitem properties at the wrong level.
DECLARE
v_firstblock VARCHAR2(50);
v_currentblock VARCHAR2(50);
v_firstitem VARCHAR2(50);
v_currentitem VARCHAR2(50);
v_counter NUMBER :=0;
v_counter2 NUMBER :=0;
begin
v_firstblock := get_form_property(:System.Current_Form,first_block);
v_currentblock:= get_block_property(v_firstblock,nextblock);
MESSAGE(v_firstblock||v_currentblock);
LOOP
v_counter := v_counter +1;
IF (v_counter >10) THEN
exit;
END IF;
IF (v_currentblock = v_firstblock) THEN
exit;
ELSE
v_firstitem := get_block_property(v_firstblock,first_item);
IF (lower(GET_ITEM_PROPERTY(v_firstitem,format_mask))=lower('mm-dd-yyyy')) THEN
SET_ITEM_PROPERTY(v_firstitem,format_mask,'DD-MON-YYYY');
END IF;
v_currentitem := get_block_property(v_firstblock,first_item);
v_currentblock:= get_block_property(v_currentblock,nextblock);
GO_BLOCK(v_currentblock);
LOOP
v_counter2 := v_counter2 +1;
IF (v_counter2>15) THEN
exit;
END IF;
v_currentitem:= get_item_property(v_currentitem,nextitem);
MESSAGE(v_counter||v_firstblock||v_currentblock||v_firstitem||v_currentitem||v_counter2);
IF (v_currentitem <> v_firstitem) THEN
IF (lower(GET_ITEM_PROPERTY(v_currentitem,format_mask))=lower('mm-dd-yyyy')) THEN
SET_ITEM_PROPERTY(v_currentitem,format_mask,'DD-MON-YYYY');
END IF;
ELSE
exit;
END IF;
END LOOP;
END IF;
END LOOP;
end;Here is updated new code. I am currently trying to debug it, it has crashed my form on the server when tied to a button press.
EDIT: So far I have found that it infinitely loops through the first 3 items and a null item in the first block. Still looking into why...
EDIT: Some code changes to temporarily stop infinite loop and make v_currentblock actually change. Still loops through same 3 items in the first data block even though v_currentblock changes.
Edited by: 878576 on Oct 21, 2011 12:46 PM -
How to loop through a single row of data?
What I'm trying to do is use a cursor to loop through a clob. When I create my cursor I get the an error telling me that the table does not exist. Which implies that I have an implicit cursor. Is there a way to get around this?
> How to loop through a single row of data?
By not looping as there is only a single row?
> What I'm trying to do is use a cursor to loop through a clob
Processing (looping through) a CLOB has nothing to do with a cursor.
> When I create my cursor I get the an error telling me that the table does
not exist. Which implies that I have an implicit cursor.
Incorrect. It simply means that
a) you do not have permissions to access that table from within the current context
b) it does not exist (e.g. you have misspelled the object name, you have not qualified it properly within the current scope, etc) -
Script code sample for looping through the records from xml data file in formCalc script
Hi
I have a xml data file which contains a sequence of repeating applicant data like given below
US
II
CEO
Mr
111111111
0000000111
GuarantorA
111
IN
11111
WILLIAMS1
R3
KENNETH1
City1GU
PA
1934-03-14
[email protected]
GU
R
113 Lazlo LaneCA
Suite 3500CA
OaklandCA
TX
11345
AL
I want to assign a textfield with a value based on the value of coap_flag.
So i need to loop through all the record and check the value of coap_flag and then assign the textfield a value based on that.
I am new to Adobe livecycle...Please help me how it can be done.
I have developed something like this
foreach Item in ($record.applicant[*].coap_flag) do
test.value=Item
if(test.value=="MA")then
concat($record.applicant.first_name,$record.applicant.middle_name)endif
endforUsing the data you posted in the forum, I copied it a couple of times to give multiple records and used this code to extract the different values that you wanted. I had to wrap it in a <root> node that I called root (to make it valid XML). In my case I wrote the extracted values to a field, but in your case you can do whatever you want with them. Note that this was done in javascript:<br /><br />var currentElement;<br />var obj;<br /><br />//Get the nodes below the root node in the dataDom<br />obj = xfa.datasets.data.root.nodes;<br /><br />//Set an initial value for the textField<br />TextField1.rawValue = "The values of the coap_flag are: ";<br /><br />//Loop through the nodes in the obj set <br />for (i=0; i< obj.length ; i++){<br /> //set the currentElement to the 1st child node<br /> currentElement = obj.item(i);<br /> //Check to see if it is an applicant node<br /> if (currentElement.name == "applicant"){<br /> //It is an applican, now find the coap_flag node value and write it to the text field<br /> TextField1.rawValue += "\n" + xfa.resolveNode("xfa.datasets.data.root.applicant[" + i + "]").coap_flag.value;<br /> }<br />}
Maybe you are looking for
-
New Macbook video import problem.
Hi all, I have just gone and bought myself a new Macbook Pro and I am very pleased with it. From a video standpoint I plan to use it to import and edit HD video from my Canon HV20. The new Macbook only has a Firewire 800 port and so the cable that I
-
Hi All, I have installed OCS 9.0.4.1 and am going to install Oracle Application Server 10g (10.1.2.0.0). Can I use the OCS infra for the AS? Kindly send a copy of the reply to [email protected] Thanks in advance.
-
Lose full screen when streaming movies
Lately when streaming netflix my screen minimizes on it's own.If I click on full screen it comes right back.The intervals are random.It just started doing this and I don't think I added anything to my computer that caused this.
-
Laser Jet 3050 not printing receipt
Sending a fax, does not print a receipt so I know it went through. Checked the manual but no obvious answer. Went through all the menu items but no luck. Anyone have an idea?
-
ODI "Missing IN or OUT parameter at index" error
Hi, Im trying to load data from several Oracle DB datasets to an Oracle table and I get the following error: "ODI-1228: Task CAPEX (Export) fails on the target ORACLE connection DEV Staging Area. Caused By: java.sql.SQLException: Missing IN or OUT pa