help of forms 6i [message #622824] |
Sun, 31 August 2014 09:04 |
kkesari
Messages: 12 Registered: June 2007 Location: MCLEAN, VA
|
Junior Member |
|
|
Hello All,
I am trying to achieve a simple thing but feeling complex in terms of making it actually happen in forms.
1. User when clicks on a form, a query find window appears
2. User provides value of column1 (required column in the query find window) and other 3 column values (optional)
3. Find button should open up a multi record form (another block in the same form) with the query results
4. The multi record block has 2 check boxes also which are blank initially for most the ones. But for some (depending on the database column value of another item, these 2 check boxes should be shown checked). Eg. If table.column3 is not null, then the two check boxes should be shown checked.
I have written this logic in the post-query of the multi-record block, a cursor from the table, looping the cursor and comparing the value of the block record items. If table record value = block record value, then make the check box checked.
5. The control block has a button 'generate' when clicked should show the number of records having the checkboxes checked.
If the step4 has 20 records checked, the step5 generate should show the count as 20.
I am again looping from first_record till :system.last_record = 'TRUE', if the block.checkbox1 = y and :block.checkbox2 = y then count:= count+1; finally end of the loop, I am displaying the count.
For some reason, the count always shows incorrectly and always less than the expected numbers.
If the table has 20 rows satisfying the condition, the count in the 'generate' shows only 3. Not sure what is going wrong. I am resetting the value of the count in the beginning of the 'generate' code. Any clues are much much appreciated.
Thanks & Regards,
Kiran
|
|
|
|
|
|
|
|
|
|
|
Re: help of forms 6i [message #622856 is a reply to message #622848] |
Sun, 31 August 2014 15:09 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
DE-SELECT ALL button is simple: in that case, :generate_count = 0.
For SELECT ALL you have several options. Looping through all record is probably the worst of them.
A better one is to include such a code into SELECT ALL button's WHEN-BUTTON-PRESSED trigger:go_block('your_block');
last_record;
:generate_count := :system.cursor_record;
Another one uses GET_BLOCK_PROPERTY built-in and its QUERY_HITS property (read about it in Forms Help). Shortly, you have to run COUNT_QUERY built-in procedure and count query hits, such asgo_block('your_block');
count_query;
:generate_count := get_block_property('your_block', query_hits);
The third option uses GET_BLOCK_PROPERTY with LAST_QUERY; you'd extract WHERE clause out of it, compose the full SELECT COUNT(*) statement (using the WHERE clause, as it depends on search criteria), dynamically create record group query and find the result (obviously, that's the most complex solution; I wouldn't use it).
|
|
|
|
|
|
|