Home » Developer & Programmer » Forms » Make a field as mandatory at current record level
Make a field as mandatory at current record level [message #458059] Thu, 27 May 2010 02:50 Go to next message
dhanasurya
Messages: 33
Registered: May 2010
Member
Hi All,
I have one requirement i.e i want to make a particular item as mandatory for the current record in the tabular form.

so i have written code as below:

DECLARE
lv_item item;
BEGIN
lv_item := FIND_ITEM ('XXMZ_DETAIL.QTY_ACT');
SET_ITEM_INSTANCE_PROPERTY (lv_item,
current_record,
required,
property_true);
END;

This code is not effecting qty field.

If i write set_item_property built-in that item becomes mandatory.But it's not effecting at current record level.It's effecting block level.

So how can i make a field as mandatory at current record level?

Please give me some idea.

Thanks,
Re: Make a field as mandatory at current record level [message #458063 is a reply to message #458059] Thu, 27 May 2010 03:09 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Code seems to be OK /forum/fa/1600/0/ Which trigger did you put it in?
Re: Make a field as mandatory at current record level [message #458064 is a reply to message #458063] Thu, 27 May 2010 03:13 Go to previous messageGo to next message
dhanasurya
Messages: 33
Registered: May 2010
Member
In that tabular form i have one list item.If i change the list with particular value then it creates a new record.In the created record i have to make qty item as mandatory.so i have written above in the when-list_changed trigger of list item.
Re: Make a field as mandatory at current record level [message #458065 is a reply to message #458064] Thu, 27 May 2010 03:21 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
then it creates a new record
Try to move that code into the WHEN-NEW-RECORD-INSTANCE trigger. Perhaps you'll have to include an IF, such as
if list_item_value = some_value then
   set_item_instance_property
end if
Re: Make a field as mandatory at current record level [message #458068 is a reply to message #458065] Thu, 27 May 2010 03:47 Go to previous messageGo to next message
dhanasurya
Messages: 33
Registered: May 2010
Member
Hi,
I have written the code in the WHEN-NEW-RECORD-INSTANCE trigger using a condition.
If i use set_item_instance_property it's not working.

If i use set_item_propery it's working and in the else part of if we have to make thet property as FALSE.then it's working.

so now my issue is closed

Thank you all..

Thank you very much...
Re: Make a field as mandatory at current record level [message #458069 is a reply to message #458059] Thu, 27 May 2010 03:54 Go to previous messageGo to next message
gregor
Messages: 86
Registered: March 2010
Location: Germany
Member
Hi dhanasurya ,
the Item-Property "REQUIRED" only fires, if an item has changed.
You can :
.... MZ_DETAIL.QTY_ACT := 'x'; --( if null before)
SET_ITEM_INSTANCE_PROPERTY (lv_item,current_record,required,property_true); MZ_DETAIL.QTY_ACT := NULL;
or
...
set_item_property(lv_item,IS_VALID,FALSE); SET_ITEM_INSTANCE_PROPERTY (lv_item,current_record,...

GG
Re: Make a field as mandatory at current record level [message #458073 is a reply to message #458069] Thu, 27 May 2010 04:12 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
But, if you first
SET_ITEM_INSTANCE_PROPERTY (lv_item,current_record,required,property_true);
and then
MZ_DETAIL.QTY_ACT := NULL;
how do you expect it to work?

You have just said "no nulls, please", then you force NULL into the item?
Re: Make a field as mandatory at current record level [message #458198 is a reply to message #458073] Thu, 27 May 2010 17:14 Go to previous message
gregor
Messages: 86
Registered: March 2010
Location: Germany
Member
Hi littlefoot,
I assigned a dummy-value i.E.'x' to QTY_ACT, if it is Null,(if "not null" don't make sense), BEFORE! setting Item_instance_property(). It works, the user can NOT leave this item. Seams to been crazy . .. but item-properties are binary and(ed) or or(ed). I don't spend more in this "feature". Because, your code works too (Q: Haven't tested your code; can the user leave the forms-item, after once clicked in?). Because, when an item should be "REQUIRED" the property for the whole column ( in the multi-record) can be set dynamic always again, with "set_item_property", (i.E on When_New-Record/Item-Instance).

GG
Previous Topic: Update random rows in a table
Next Topic: how to know that file is available or not
Goto Forum:
  


Current Time: Thu Sep 19 19:35:21 CDT 2024