Home » Developer & Programmer » Forms » Counter (merged by CM)
Counter (merged by CM) [message #438642] Mon, 11 January 2010 06:11 Go to next message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
Hi guyz,

i have an master details form in details form i have one non database item which called counter.

it will count how many records in Details forms.

also have check box in my details form. when user check the check box it will minus the total records in counter item
like if i have 9 total items in counter it will show 8 if user check the check box if uncheked it will plus the value.

anyone tell me how can i deal with this counter?

anyhelp appreicate plz.
Regards

Re: Counter (merged by CM) [message #438732 is a reply to message #438642] Tue, 12 January 2010 00:08 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
You can do a 'count_query' in the 'pre-query' trigger, assign it to your display item, then use 'when-checkbox-changed' trigger to subtract and add to this counter.

David
Re: Counter (merged by CM) [message #439393 is a reply to message #438642] Sat, 16 January 2010 03:12 Go to previous messageGo to next message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
Thx Martin,

let me explain you my scenarion i'm in urgent need of i tried a lot but i failed to do, can you give me some syntx please i have to submit my project ASAP. and im stuck in this. Sad

I have two display items on master block.
MASTER.DIS_FLAG
MASTER.COUNTER
MASTER.DIS_FLAG ='N' BY DEFAULT

when user query the record MASTER.COUNTER will display and count how many records in detail block.

how can i get total records from DETAILS block in MASTER.COUNTER after query?

and i have the checkbox (NON DATABASE ITEM) in detail block when user click the checkbox it will update the MASTER.DIS_FLAG='Y' when counter goes to '0' zero im using the below code to update the details block status on WHEN-CHECKBOX-CHANGE trigger.
IF :DT_ADN_DETAILS.STATUS='N' THEN
UPDATE DT_ADN_DETAILS SET STATUS='Y';
END IF;

suppose if query get the 4 records in details block and when user click on checkbox it will update the MASTER.COUNTER and minus the record example (-1) and when user uncheck the checkbox it will update the counter (+1) and i want to do this updation MINUS and PLUS can you give me some syntax that i will achive this task soon.

Thx for your kind help. Razz
Regards




Re: Counter (merged by CM) [message #439399 is a reply to message #439393] Sat, 16 January 2010 03:28 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
David has already replied (but you didn't want to research what's being said).

You
how can i get total records from DETAILS block in MASTER.COUNTER after query

David
You can do a 'count_query' (LF: COUNT_QUERY is a built-in) in the 'pre-query' trigger, assign it to your display item


You
i want to do this updation MINUS and PLUS

David
use 'when-checkbox-changed' trigger to subtract and add to this counter
Re: Counter (merged by CM) [message #439417 is a reply to message #438732] Sat, 16 January 2010 09:32 Go to previous messageGo to next message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
Hi DJ,

Thx for your reply. DJ please could you help me in this substract and add to this counter i get all the total in the bloc by using the below code
:DT_ADN_MASTER.COUNTER :=GET_BLOCK_PROPERTY('DT_ADN_DETAILS',QUERY_HITS);


but how can i add and substract the counter by using the checkbox? if value is Y it should be substract if N it should be add.

Regards
Re: Counter (merged by CM) [message #439419 is a reply to message #439417] Sat, 16 January 2010 09:40 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did you check whether the checkbox is checked?
if checkbox_checked(:detail_block.checkbox_item) then
   :master_block.counter_item := :master_block.counter_item + 1;
else
   :master_block.counter_item := :master_block.counter_item - 1;
end if;
Re: Counter (merged by CM) [message #439420 is a reply to message #439419] Sat, 16 January 2010 09:51 Go to previous message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
Its PERFECT bundle of thx buddy....... Cool
Previous Topic: FRM-40654: Record has been updated by another user. Re-query to see change
Next Topic: Medical product code list
Goto Forum:
  


Current Time: Thu Dec 08 22:11:53 CST 2016

Total time taken to generate the page: 0.09632 seconds