IndoTech
16th May 2016, 13:13
Hi,

In LN I have a array field specific types spe.typ(10)

these 10 elements are for input on form and wants to disable input for

spe.typ(3) = false if value of spe.typ(2) is space. how this can be achieved


Thanks
kedar

Ajesh
16th May 2016, 14:47
Hello There


What you can do is



field.spe.typ(3):
before.display:
if isspace(spe.typ(2)) then
disable.fields(spe.typ(3))
endif

IndoTech
16th May 2016, 15:23
Hi Ajesh

I tried

field.spe.typ(1,3):
before.display:
if isspace(spe.typ(1,2)) then
disable.fields(spe.typ(1,3))
endif

but it shows "before.display" not expected even tried before.field but same error

thanks
kedar

mark_h
16th May 2016, 15:50
In 4c4 I do not think you can use something like field.spe.type(3) or field.spe.typ(1,3) in the script. So if I was doing it in 4c4 I would have field.spe.typ: as the section. Then in the before.display I would check attr.element. If it was 2 then I would run your check. Something like this:

field.spe.typ:
before.display:
if attr.element =3 then | You know you are trying to enter the 3rd element in the array
if isspace(spe.typ(1,2)) then
disable.fields(spe.typ(1,3))
endif
endif

IndoTech
17th May 2016, 08:51
Hi, Mark

Tried the same, but it just ignores disable.fields(spe.typ(1,3)) and allow input.

Regards
Kedar

bdittmar
17th May 2016, 10:41
Hello,

disable.fields()
Syntax:

function void disable.fields ( [long mode], string field [,occurrence],...)

Description


This disables single-occurrence and multi-occurrence fields on a form.

To disable all fields of a group, see disable.group().

Because the information is not available, you can not use this function in the before.program section.


Arguments

[long mode ] This is an optional argument. It has two possible values:

DISABLE This is the default mode and does not need to be specified.

READONLY The field(s) become read-only fields that cannot be edited by the user.

string field [,occurrence],... This identifies the field to be disabled.

For a single-occurrence field, this is the field name. For a multioccurrence field, this can be either the field name or the field name followed by an occurrence number (depending on whether you wish to disable all occurrences of the field or only one particular occurrence).

For array fields, UTC fields, and segmented fields, you can append suffixes to the field name to indicate the particular element or segment to be disabled. If you omit these suffixes, all elements/segments are disabled.

To disable a particular element of an array field, append the element number (in parentheses) to the field name. The element number must be an integer, formatted as a string. It cannot be a variable. For example: "tfmod100.perd(10)".
To disable only the date or time element of a UTC field, append either .date or .time to the field name. For example: "ttadv300.cdat.time".
To disable a particular segment of a segmented field, append .segment.segment_id to the field name. For example: "tiitm001.item.segment.1".


Examples:

| Disable element number 10 of an array field
disable.fields( "tfmod100.perd(10)" )

| Disable elements 1 to 12 of an array field
for i = start to 12
disable.fields( "month(" & str$(i) & ")" )
endfor

Ajesh
17th May 2016, 11:29
Hi Kedar

Thats right. Just try putting in double quotes like


disable.fields("spe.typ(3)")

IndoTech
18th May 2016, 08:29
Hi

Thanks, it works..

Regards
Kedar