Update record in detail block [message #663660] |
Tue, 13 June 2017 13:41  |
 |
Amjad_1975
Messages: 82 Registered: January 2017
|
Member |
|
|
My question is to all this forum that I am updating record in detail block something like this
Icode. Qty.
1001. 1
1002 1+1
1003 1
If 1002
My question is if same record will again like 1002 record should be update only qty mean + 1
Thanks in advance
[EDITED by LF: fixed topic title typo]
[Updated on: Tue, 25 July 2017 01:12] by Moderator Report message to a moderator
|
|
|
|
|
Re: Upate record in detail block [message #663673 is a reply to message #663671] |
Wed, 14 June 2017 03:26   |
 |
Amjad_1975
Messages: 82 Registered: January 2017
|
Member |
|
|
Thanks for quick response sir actually I have designed point of sale application and I am using barcode scanner picking one by one record from stock such as item code, item name price and quantity = 1
As u I have mentioned in above post
Text_field taking barcode entry
And in detail block as
Item_code item_name price qty
0001 laptop 260 Rial 1
0006 mobile 150 Rial 1
0008 led 60 Rial 1
Now if item_code 0001 or 0006
again comes thn record should not be add into detail block only qty should be add +1 means qty will be 2 if duplicates record comes thn qty should be add sorry for my this much bad English
Thanks
LF applied [code] tags]
[Updated on: Wed, 14 June 2017 13:52] by Moderator Report message to a moderator
|
|
|
|
Re: Upate record in detail block [message #663675 is a reply to message #663674] |
Wed, 14 June 2017 04:21   |
 |
Amjad_1975
Messages: 82 Registered: January 2017
|
Member |
|
|
Thanks for reply sir yes key-next-item will be acceptable for barcode reader sir i tried code this for checking duplication and also successfully adding in qty but record also added in the detail block
Declare
A number (1 )
F_name varchar2 (35)
Begin
F_name:=:zz
First_record
While :zz is not null loop
If f_name=:zz then
:b:=:b+1
A:=A+1
Select icode,inane......
End if
Next_record
End loop
Previous_record
End;
It's working fine but also detail are adding in detail block such as icode, inane
I wanted only qty should be +1 not detail
Sir kindly assist me where am wrong
Thanks
CM: added end [/code] tag
[Updated on: Wed, 14 June 2017 04:34] by Moderator Report message to a moderator
|
|
|
|
|
Re: Upate record in detail block [message #663720 is a reply to message #663678] |
Thu, 15 June 2017 03:35   |
cookiemonster
Messages: 13966 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
I can't correct the code unless I know the names of all the datablock items involved.
:qty := :qty + 1
will be fine.
I have no idea where the variable barcode came from - or is it a datablock item and you left off the : ?
Precision matters when you want help with syntax issues.
[Updated on: Thu, 15 June 2017 03:36] Report message to a moderator
|
|
|
|
|
|
Re: Upate record in detail block [message #663734 is a reply to message #663724] |
Thu, 15 June 2017 07:48   |
 |
Amjad_1975
Messages: 82 Registered: January 2017
|
Member |
|
|
Thanks for reply
DECLARE
l_match boolean:=false;
BEGIN
FIRST_rECORD;
WHILE :system.last_record != 'TRUE' AND NOT L_MATCH LOOP
IF :EMP.item_code=:CONTROL.barcode THEN
:EMP.qty:=:EMP.qty+1;
L_MATCH:=TRUE;
ELSE
NEXT_RECORD;
END IF;
END LOOP;
IF NOT L_MATCH THEN
select empno,ename into :emp.item_code,:emp.ename from emp where empno=:control.barcode;
NEXT_RECORD;
:EMP.item_code:=:CONTROL.barcode;
END IF;
END;
sir I tried your code but qty is not + result is same adding a duplicate record record
[Updated on: Thu, 15 June 2017 07:54] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
Re: Upate record in detail block [message #665040 is a reply to message #664793] |
Fri, 18 August 2017 14:38  |
 |
Amjad_1975
Messages: 82 Registered: January 2017
|
Member |
|
|
Sir still this error is coming record must be entered and delete first I tried to control it frm-40375 by using on-error trigger its working by cursor is not going to the particular block and field can any one guide me where is the mistake in above code I have 3 blocks here
1. Master_block
Fields date,invoice No,customer name
2. Transactions block
Item_code,item_name,qty,price
3 control block
Barcode --here I write the code in key-next-item trigger
problem is as I mentioned in my previous post
[Updated on: Fri, 18 August 2017 14:50] Report message to a moderator
|
|
|