how can i change item lenght and how to block an item to update and new insert 6 (merged) [message #331005] |
Wed, 02 July 2008 02:11  |
nyc212
Messages: 14 Registered: May 2008
|
Junior Member |
|
|
hellow
i have an item which is a db column, it is defined as varchar2(70). This item is a description item, until today i allowed the user to set description in this item with up to 70 characters but now i want to block this item that the users will be able to insert only descriptions with 40 characters long. I also dont want them to update it to more then 40 .
do i need to use "when-new-item-instance" trigger and to use the "set_item_property" command inside??
please help me
Ami
|
|
|
how to block an item to update and new insert [message #331007 is a reply to message #331005] |
Wed, 02 July 2008 02:18   |
nyc212
Messages: 14 Registered: May 2008
|
Junior Member |
|
|
hellow
i want to block an item (which is 70 characters long) for update and new item.
it is an item based on a db column ( it's a material description column ) untill todaye i allowed users to fill up to 70 characters in this filed and now i want to block this option and to allowed them to add max 40 to this filled when they are adding new description or updating on.
Do i need to use the trigger "WHEN-NEW-ITEM-INSTANCE" and in it the command "SET_ITEM_PROPERTY" ??? will it work both in update and new insert ?
please help
Ami
|
|
|
|
|
|
|
|
|
|
|
Re: how can i change item lenght [message #331136 is a reply to message #331119] |
Wed, 02 July 2008 06:06   |
nyc212
Messages: 14 Registered: May 2008
|
Junior Member |
|
|
its an item which is a DB column
its defined as varchar2(70)- its a material description column and i want to limit it to 40 characters when the user create a new item or blocking it when a user try to update the description to a description that is over 40 char ?
|
|
|
|
|
|
Re: how can i change item lenght [message #331354 is a reply to message #331068] |
Thu, 03 July 2008 01:55   |
averno9
Messages: 30 Registered: June 2008 Location: Spain
|
Member |
|
|
Maybe he is saying that, in a particular form, he wants an input of 40 maximum, and in other form he would be able to put a 70 characters length. If you cannot ever input something of 70 characters, it's a waste of memory.
If that's what you are looking for, you could put a format mask in your field. If you want 40 letters maximum, put X in you format mask 40 times (i don't even know if you can put so many X). And if you want to be 40 letters or less, put FM and then 40 X. Maybe this last, will fill with blanks your string, or maybe if it's a VARCHAR2 it won't do that, i don't really know.
|
|
|
Re: how can i change item lenght [message #331365 is a reply to message #331354] |
Thu, 03 July 2008 02:28   |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
Sorry, but this just does not make sense (to me). It sounds like a major error in design.
Sounds like we are trying to reuse a column for generic purposes: depending on the input of one column, the function of another column changes. That is a big no-no in relational databases!
|
|
|
Re: how can i change item lenght [message #331439 is a reply to message #331365] |
Thu, 03 July 2008 05:47   |
nyc212
Messages: 14 Registered: May 2008
|
Junior Member |
|
|
i will try to explin myself i want to let the user to enter only 40 characters despite the fact that the text item can get up to 70 char ( the text item is based on DB column that is varchar2(70)) and i want to limit the user to 40 char because i take the item he updated or insered from the oracle DB and load it to another DB there the same column is in type varchar2(40) and i want to limit the user insted of substructing the string he is inserting.
|
|
|
Re: how can i change item lenght (Merged) [message #331447 is a reply to message #331068] |
Thu, 03 July 2008 06:02   |
averno9
Messages: 30 Registered: June 2008 Location: Spain
|
Member |
|
|
To do that, put in your format mask FMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. (40 X letters) But, again, this is not a good solution. You should put two text items, one for the table with the field of 70 size, and another for the field of 40 size.
Don´t make things hard, when you can do them so easily. Time will bring you real problems that cannot be solved in a easy way, so relax until then.
|
|
|
Re: how can i change item lenght (Merged) [message #338152 is a reply to message #331447] |
Mon, 04 August 2008 00:38  |
 |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
Why not just test the length of the item in the 'when-validate-item' trigger and if it is greater than required then issue a message and do a 'raise form_trigger_failure' to stop further processing.
In the form make the display length less than the data length.
David
|
|
|