This content has been marked as final. Show 12 replies
Somewhere to start would be to write a Forms procedure containing the code and call it from KEY-ENTQRY and KEY-EXEQRY so:
(and if you have buttons to do the queries then the same sort of thing would apply)
Edited by: spilgrim on Apr 12, 2012 11:16 AM
A better way would be to use calculated item for that.1 person found this helpful
-Create a calculated item of type formula in your block, as formula put something like
-Create a calculated item of type Summary which does a sum over the formerly created item.
CASE WHEN :CONDITION_ITEM='Yes' THEN 1 ELSE 0 END
-Create a function in your form which does something like:
-Create a last calculated item of type formula in your block, as formula put a call to your function
FUNCTION FK_ENABLE_DISABLED (i_nDummy IN NUMBER) RETURN NUMBER IS BEGIN IF <calculated item of type summary> >2 THEN --disable item ELSE --enable itemn END IF; END;
FK_ENABLE_DISABLE(<calculated item of type summary>)
Why don't u think of creating a button and using WHEN-BUTTON-PRESSED Trigger ?!
Or try POST-SELECT , when-validate-record Trigger
post-query trigger is always used 2 display data in non-display items.
Hope this helps...
Thanks very much for the help, never used fields in this way before and it seems really useful. However when i add the calculation field my form doesnt seem to compile due to errors with unrelated fields oon a different block which I have not even touched. I have no idea what could be causing this issue the error im getting is: Warning: Required property ignored for subordinate mirror item . But I havent done anything which should cause this and when I take teh summary field out it again it works fine. Do you have any ide what couldbe causing this issue?
Edited by: 786733 on 12-Apr-2012 04:26
1 person found this helpful
I have no idea what could be causing this issue the error im getting is: Warning: Required property ignored for subordinate mirror item .That's just a warning. And i guess its always there, but you ignored it because the forms runs anyway. There will be another error in the error-window, i guess its something about Setting the property Query all records, or the block where the summary item has to be.
Or try POST-SELECT , when-validate-record TriggerBoth won't allow looping over the records in a block.
was just wondering !!!
Why it won't allow looping over the records in a block ?
Thanks Andreas Weiden
ur idea is really brilliant regarding the Case Statment & Function :)
Thanks again andreas, its all compiling now however, the last bit where I was to create a last calculated field with a call to my procedure doesnt seem to be working, I keep getting the message stating that my procedure must be declared, but it is declared and I can call it in other places but just not in the formula property field of that item. so out of curioisty I tried to put the call the function on post query trigger and the first formula field returned 1 each time as it should, but the calculation field which was suppose to add them up never had any value in it. Maybe im doing something stupid. Thanks for the help so far.
What exactly did you put in the formula-code? Is your function defined in the form or in the database (should be form).
its done on the form and I simply put
CASE WHEN :block1.STATUS='YES' THEN 1 ELSE 0 END
for my summary field I have:
status_formula as my properties.
And the last one, with the function-call?
My guess is u have created a summary item not a formula item no ?
So u have to change the calulation mode > Formula
Formula > < call ur function in this property >
that's what is meant by ...
Create a last calculated item of type formula in your block, as formula put a call to your functionHope i am the Lucky Guess...