Problem in Cursor [message #174992] |
Wed, 31 May 2006 06:17 |
emadbsb
Messages: 334 Registered: May 2005 Location: egypt
|
Senior Member |
|
|
Hii all
i have a button that when i press on it open a new view and perform that code
Quote: |
DECLARE
CURSOR cDIS IS
SELECT GDACLXXXX.CODE CODE, GDACLXXXX.DAILY_DATE DAILY_DATE, SUM(GDACLDTXX.VALUE) VALUE
FROM GDACLXXXX, GDACLDTXX
WHERE GDACLXXXX.CODE = GDACLDTXX.GDACL_CODE
GROUP BY CODE, DAILY_DATE;
BEGIN
FOR vDIS IN cDIS LOOP
:DIS.CODE :=vDIS.CODE;
:DIS.DATE :=vDIS.DAILY_DATE;
:DIS.VALUE :=vDIS.VALUE;
NEXT_RECORD;
END LOOP;
SHOW_VIEW('STKITEMSTORES');
|
THE CANVAS 'STKITEMSTORES'
HOLD THE DATABLOCK 'DIS'
THAT CONTAIN THE ITEMS 'CODE','DAILY_DATE','VALUE'
THE RESULT OF THE CURSOR IS
Quote: |
CODE DAILY_DAT VALUE
------- --------- ---------
1 01-JAN-06 110
2 01-FEB-06 20
|
BUT IN THE DISPLAYED CANVAS IT DISPLAYS ONLY THE SECOND ROW
how can i solve this ??
Thanks for everyone helped and helping me
|
|
|
Re: Problem in Cursor [message #175009 is a reply to message #174992] |
Wed, 31 May 2006 07:10 |
jowahl
Messages: 82 Registered: May 2006
|
Member |
|
|
maybe the function NEXT_RECORD does not work due to validation errors?
check out what the cursor really does, e.g. by inserting some messages:
BEGIN
FOR vDIS IN cDIS LOOP
MESSAGE('Begin filling data');PAUSE;
:DIS.CODE :=vDIS.CODE;
:DIS.DATE :=vDIS.DAILY_DATE;
:DIS.VALUE :=vDIS.VALUE;
MESSAGE('Skipping next record');PAUSE;
NEXT_RECORD;
END LOOP;
END;
|
|
|
|
Re: Problem in Cursor [message #175036 is a reply to message #175034] |
Wed, 31 May 2006 08:27 |
jowahl
Messages: 82 Registered: May 2006
|
Member |
|
|
do you have any WHEN-VALIDATE-ITEM or WHEN-VALIDATE-RECORD triggers that cause NEXT_RECORD to fail?
maybe ther are required items which have no value?
|
|
|
|
Re: Problem in Cursor [message #175040 is a reply to message #174992] |
Wed, 31 May 2006 08:40 |
emadbsb
Messages: 334 Registered: May 2005 Location: egypt
|
Senior Member |
|
|
I wrote 'go_block'
so that the code become
Quote: |
DECLARE
vDIALY_SUM NUMBER;
vCARD_SUM NUMBER;
vCURRECORD NUMBER;
CURSOR cDIS IS
SELECT GDACLXXXX.CODE CODE, GDACLXXXX.DAILY_DATE DAILY_DATE, SUM(GDACLDTXX.VALUE) VALUE
FROM GDACLXXXX, GDACLDTXX
WHERE GDACLXXXX.CODE = GDACLDTXX.GDACL_CODE
GROUP BY CODE, DAILY_DATE;
BEGIN
GO_BLOCK('DIS');
FOR vDIS IN cDIS LOOP
:DIS.CODE :=vDIS.CODE;
:DIS.DATE :=vDIS.DAILY_DATE;
:DIS.VALUE :=vDIS.VALUE;
next_record;
END LOOP;
SHOW_VIEW('STKITEMSTORES');
END;
|
i still have the same problem
[Updated on: Wed, 31 May 2006 08:40] Report message to a moderator
|
|
|
Re: Problem in Cursor [message #175047 is a reply to message #174992] |
Wed, 31 May 2006 09:17 |
jowahl
Messages: 82 Registered: May 2006
|
Member |
|
|
if your view is not visible, you can not navigate there with GO_BLOCK. also NEXT_RECORD will fail, if your cursor is in the wrong block.
try to make the view visible an then load data from cursor.
|
|
|
|
|
|
Re: Problem in Cursor [message #175159 is a reply to message #174992] |
Thu, 01 June 2006 02:18 |
emadbsb
Messages: 334 Registered: May 2005 Location: egypt
|
Senior Member |
|
|
I attached the form
and this is the table creation and insertion script :
Quote: |
CREATE TABLE GDACLDTXX (
GACCO_CODE NUMBER(5),
DUE_DATE DATE,
VALUE NUMBER(10,2)
);
|
THE INSERTION
Quote: |
insert into GDACLDTXX
(GACCO_CODE,DUE_DATE,VALUE )
values
('1','10-MAY-2006','10');
insert into GDACLDTXX
(GACCO_CODE,DUE_DATE,VALUE )
values
('2','10-DEC-2006','20');
insert into GDACLDTXX
(GACCO_CODE,DUE_DATE,VALUE )
values
('3','20-DEC-2006','40');
insert into GDACLDTXX
(GACCO_CODE,DUE_DATE,VALUE )
values
('4','20-OCT-2006','50');
|
-
Attachment: PROBLEM.fmb
(Size: 52.00KB, Downloaded 1017 times)
|
|
|
|
Re: Problem in Cursor [message #175164 is a reply to message #174992] |
Thu, 01 June 2006 02:37 |
jowahl
Messages: 82 Registered: May 2006
|
Member |
|
|
why didn't you post the error that occurs when pushing the button???
"... you can not create records here."
now the solution is simple: set the block property of DIS to "insert allowed = Y"
in your cursor you now can use both: NEXT_RECORD or CREATE_RECORD.
|
|
|
|