how to check all customer numbers by checking select all check box in forms [message #427138] |
Wed, 21 October 2009 05:27 |
anusha539
Messages: 7 Registered: October 2009 Location: Hyderabad
|
Junior Member |
|
|
Hi All,
I have one requirement related to check box.In my form i have customer number,customer name.. etc fields,and before customer number i have a check box(cb_1).
select all(cb)
cb_1 customer number customer name
- 1001 ABC Customer
- 1001 ABC Customer
- 1002 XYZ Customer
- 1002 XYZ Customer
If i check customer number ( 1001) check box it should select all 1001 Customers. If i check customer number (1002) check box it should select all 1002 Customers. I have done the above task.But i struck with below task. I need to place a "Select All" Check box at top of the another check box(CB_1) in the form.Where CB_1 is associated with the form fields.when I click on "Select All" check box it should select the CB_1 check box i.e automatically all customer numbers are checked.If i unchecked it then all customer no's are unchecked.
I have written the following code in my form:
for first checkbox(CUSTOMER_NUMBER_CBX):
DECLARE
vCurRec NUMBER;
CURSOR c1 (p_test VARCHAR2)
IS
SELECT CUSTOMER_NUMBER
FROM XXMCS_CUSTOMERS_V
WHERE CUSTOMER_NUMBER = :XXMCS_CUSTOMER_DETAILS.CUSTOMER_NUMBER;
v_name_lov VARCHAR2 (1000);
BEGIN
vCurRec:=:SYSTEM.CURSOR_RECORD;
IF :XXMCS_CUSTOMER_DETAILS.CUSTOMER_NUMBER_CBX = 1
THEN
OPEN c1 (:XXMCS_CUSTOMER_DETAILS.CUSTOMER_NUMBER);
FIRST_RECORD;
LOOP
FETCH c1
INTO v_name_lov;
IF :XXMCS_CUSTOMER_DETAILS.CUSTOMER_NUMBER = v_name_lov
THEN
:XXMCS_CUSTOMER_DETAILS.CUSTOMER_NUMBER_CBX := 1;
END IF;
IF :SYSTEM.LAST_RECORD = 'TRUE'
THEN
EXIT;
END IF;
NEXT_RECORD;
END LOOP;
GO_RECORD(vCurRec);
else
OPEN c1 (:XXMCS_CUSTOMER_DETAILS.CUSTOMER_NUMBER);
FIRST_RECORD;
LOOP
FETCH c1
INTO v_name_lov;
IF :XXMCS_CUSTOMER_DETAILS.CUSTOMER_NUMBER = v_name_lov
THEN
:XXMCS_CUSTOMER_DETAILS.CUSTOMER_NUMBER_CBX := 2;
END IF;
IF :SYSTEM.LAST_RECORD = 'TRUE'
THEN
EXIT;
END IF;
NEXT_RECORD;
END LOOP;
GO_RECORD(vCurRec);
END IF;
END;
for second checkbox(CUSTOMER_NUMBER_ALL_CBX):
DECLARE
vValueCB VARCHAR2(1);
vValueCust VARCHAR2(100);
vCurRec NUMBER;
BEGIN
vValueCust:=:XXMCS_CUSTOMER_DETAILS.CUSTOMER_NUMBER;
vValueCB:=:XXMCS_CUSTOMER_DETAILS.CUSTOMER_NUMBER_ALL_CBX;
vCurRec:=:SYSTEM.CURSOR_RECORD;
LOOP
NEXT_RECORD;
IF :XXMCS_CUSTOMER_DETAILS.CUSTOMER_NUMBER = vValueCust THEN
:XXMCS_CUSTOMER_DETAILS.CUSTOMER_NUMBER_CBX := vValueCB;
END IF;
EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
NEXT_RECORD;
END LOOP;
GO_RECORD(vCurRec);
END;
Code for first check box is working fine,but for second one is not working.i.e when I click on "select all " check box it is not selecting all customer numbers.
can anyone please help me.
Thank you in advance,
Anusha.
|
|
|
|
|
|
|