This content has been marked as final. Show 17 replies
You would use GET_ITEM_PROPERTY to extract the label from the item.
For example, you could create a WHEN-CHECKBOX-CHANGED trigger for your first item (:CTRL.ITEM1 for example) that looks like this:
When the user checks the Item 1 checkbox, then its label is assigned to the text item (:CTRL.ITM for this example).
if :ctrl.item1 = 'Y' then :ctrl.itm := get_item_property('CTRL.ITEM1', label); end if;
thanks francois and ml , but iam so sorry , i need the label of the item not value as i said in the title
of the question ,
i just could not edit the title .
and i think francois is talking about getting the value , and ml talking about the label ,
so , ml , i have about 6 check_boxes , so , is this the way to deal with this problem
should i write these lines with every check_box i've got ?
If you didn't want to create WHEN-CHECKBOX-CHANGED triggers for each of the items, you could always create the trigger at the block level and instead of hardcoding the item name you could use :SYSTEM.CURSOR_ITEM:
The above example assumes the name of your block is CTRL, and the name of the text item is ITM for that block.
:ctrl.itm := get_item_property(:system.cursor_item, label);
You would still have to worry about the validations such as: can only one checkbox be checked, do you only want the label if the checkbox is checked - not unchecked, etc...
is there a difference francois between assigning the value or the label to an item ?
by the way , i did it , but what i can not do now is :
an example ,
when the user check the "diabetic" check_box , then the item holds "diabetic" , and if the user checks another check_box "has stomach pain" , then the item holds "diabitic , has stomach pain" .
but if he figures out that he should not have checked the "diabetic" box , then the diabetic words is removed from the
You could do a WHEN-CHECKBOX-CHANGED trigger at the block level that did something like this:
It would fire and rebuild the label each time a checkbox was changed.
declare v_symptoms varchar2(240) := 'Has '; begin -- -- Check to include the symptoms -- if :patient.diabetic_check = 'Y' then v_symptoms := v_symptoms || 'diabetes, '; end if; if :patient.has_stomach_pain = 'Y' then v_symptoms := v_symptoms || 'stomach pain, '; end if; if :patient.has_headache = 'Y' then v_symptoms := v_symptoms || 'headache, '; end if; if :patient.has_broken_leg = 'Y' then v_symptoms := v_symptoms || 'broken leg, '; end if; -- -- Check to see if they have any symptoms. If they do record -- them in the text item. -- if v_symptoms = 'Has ' then :patient.symptoms := null; else :patient.symptoms := rtrim(v_symptoms, ', '); end if; end;
thanks for all of you , but i got it .
for all who might need it .
about diabitic check_box -- it's label is "diabitic"
if :diabitic = 'y'
:text_item := get_item_property(:diabitic,label)
elsif :diabitic = 'n'
select replace (:text_item,'diabitic','') into :text_item from dual ; -- into the same :text_item
end if ;