igdigd
15th December 2006, 11:46
We have a table with an occurs field, who can I choose an occurrence to make attr.input = false
we try:
field.ttxxx000.campo:
before.input:
if (......)
attr.input = false
endif
but it doesn´t work for only some occurrence. It disables all of them.
bdittmar
15th December 2006, 12:09
We have a table with an occurs field, who can I choose an occurrence to make attr.input = false
we try:
field.ttxxx000.campo:
before.input:
if (......)
attr.input = false
endif
but it doesn´t work for only some occurrence. It disables all of them.
BaanERP Programmers Guide
mark.occ()
--------------------------------------------------------------------------------
Syntax
void mark.occ( long occurrence )
Description
This marks the specified occurrence with a reverse bar, makes the marked record the current record in the database, and sets the predefined variable actual.occ to the marked occurrence.
The following predefined variables are relevant to this function:
marked
Use this to check whether an occurrence is marked or not. This can also be tested in the on.exit subsection of a zoom process.
mark.status
This is available in the subsections before.choice and after.choice of choice.mark.occur. It indicates the type of marking that the 4GL engine is executing. It can have the following values:
DUPL.OCCUR during marking for copying
TEXT.MANAGER during marking for edit text
0 in all other cases and when not marking
Note
Use remove.mark() to unmark the occurrence.
Context
4GL library function.
You can use this function only in 4GL scripts, and only in choice and form sections of those scripts. You cannot use it in programs of type 4.
Regards
mark_h
15th December 2006, 16:22
We have a table with an occurs field, who can I choose an occurrence to make attr.input = false
we try:
field.ttxxx000.campo:
before.input:
if (......)
attr.input = false
endif
but it doesn´t work for only some occurrence. It disables all of them.
Well without knowing what is in the "(....)" in is really hard to help. This should work. Check it in debug mode and see what is happening. And maybe provide enough of the script so we can see what might need to be changed. Since you are inserting records the current records fields should be available, but only if they have been entered for this record. Are you trying to check something from a previous input record? More info is needed.
george7a
15th December 2006, 17:07
but it doesn´t work for only some occurrence. It disables all of them.
I think the your condition "(....)" is always true and that is why you are getting all fields disabled. I tried to do a simple test with maintain Areas and I managed to disable the description field when ever the Area code didn't include "0". All I did was:
field.tcmcs045.dsca:
before.input:
if pos(tcmcs045.creg, "0")>0 then
attr.input = false
endif
So, yes, you can disable some of the fields and not all of them. You can debug your code to see the result of your condition.
I hope it helps,
- George
igdigd
18th December 2006, 08:53
We have a table with an occurs field, (hours of january, february,....,december). How can we choose some occurrences (for example, march, june, september and december) to make them attr.input = false?
Hours/month
January February March April May June .................... December
Peter 172 156 167,5 128 159,75 147 106,25
Maria 172 150 xxxx xxxx xxxx xxxx xxxx
Jon 172 156 xxxx xxxx xxxx xxxx xxxx
Jose 172 154 xxxx xxxx xxxx xxxx xxxx
Irene 170 156 xxxx xxxx xxxx xxxx xxxx
we want to make disable march, june, september and december:
field.ttxxx000.hours: (The depth of field ttxxx000.hours is 12)
before.input:
"if (march or june or september or december)"
attr.input = false
endif
but it doesn´t work for the four occurrences, it disables all of them.
george7a
18th December 2006, 09:23
Hi,
Did you debug your code? Does it reach the "attr.input = false"?
- George
mark_h
18th December 2006, 15:21
we want to make disable march, june, september and december:
Try checking attr.element - I think this relates to the depth on the field. I can only assume that element 1 is January. Your check would look like this:
if attr.element =3 or attr.element = 6 ..... then
attr.input = false
endif
If this does not work post the actual code.
igdigd
21st December 2006, 16:12
Thank you , attr.element works fine.