cancel
Showing results for 
Search instead for 
Did you mean: 

formcalc help

Former Member
0 Kudos

Folks,

I need to write this expression in formcalc.

<i><b>if (this.rawValue == 1) {

data.first.Positions.P1.presence = "visible"

data.first.Positions.P2.presence = "invisible"

}</b></i>

please help me

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Manish,

Try

if ( $ == 1 ) then

$.first.Positions.P1.presence = "visible"

$.first.Positions.P2.presence = "hidden"

endif

Regards,

Amit

Former Member
0 Kudos

Hi Amit,

This code is not working and it is throwing error .

thanks

Former Member
0 Kudos

Manish,

Whats the error?

try

if($.rawValue == '1')

Thanks and regards,

Anto.

Former Member
0 Kudos

Anthony ,

The error is related to Accessors , not with if statement . Using javascript i can access

<b>data.first.Positions.P1.presence = "visible"</b>

So I need to know how to access the form-field using formcalc

Thanks

Manish

Former Member
0 Kudos

k.

Hey,

$ -> current field

$.parent -> the parent node of the referring field

$record. -> the root node in the hierarchy.

Make sensible use of it. Don't make too long access path. If you can display your hierarchy, we may help you or you can try your own. there is help in the script editor for these.

you will get more info about the accessors in the life cycle designer help.

Thanks and Regards,

Anto.

Former Member
0 Kudos

thanks anto

the hierarchy is

---first(page)

---Positions

---P1

---P2

Manish

Former Member
0 Kudos

---first(page)

-


Positions

-


P1

-


P2

Former Member
0 Kudos

Hey manish,

for which field are you writing the script?

eg: if you need to access from the root node, you may write -

$record.first.positions.p1.presence = "hidden" ya

"visible" as the case may be.

Thanks and Regards,

Anto.

Former Member
0 Kudos

Hi Anthony

I have field called P1 and P2 and I need to make them invisible/visible from another drop down . So I need to write the code in exit event of dropdown , i tried with this code , but still it is throwing error

$record.first.Positions.p1.presence = "invisible"

Thanks,

Manish

Former Member
0 Kudos

Manish,

Is 'Positions' in your hierarchy the dropdown?

- Anto.

Former Member
0 Kudos

Hi Anto

<u><b>Positions</b></u> is a subform and in that subform I have fields P1 and P2 , the drop down is placed in another subform , And <u><b>first</b></u> is a page holding all subforms.

Thanks,

Manish

Former Member
0 Kudos

the reason i asked you was, i would like to know the hierarchy between the drop down and the fields P1 and P2. Only then can we write the accessor path. lets close this issue fast.

Rgds,

Anto.

Former Member
0 Kudos

Thanks Anthony

The heirarchy of Dropdown is

<b>--first(page)

-


BasicData

-


BDDetails

-


Positions

-


number_of_positions(dropdown)</b>

The heirarchy of text fielf is

<b>--first(page)

-


Positions

-


P1(text field)

-


P2(text field)</b>

Former Member
0 Kudos

Assuming, the hierarchy gioes something like this -

first(page)

-BasicData

-BDDetails

-Positions

-


P1

-


P2

-dropdown. (Basic Data, BD details, POsitions, drop down, all at the same level and P1, P2 with in the Positions).

Write the script in the dropdown -

$.parent.Positions.p1.presence = "visible" / "hidden"

$.parent.positions.p2.preence = "visible" / "hidden".

Note - it is case sensitive. Check at the hierarchy.

Hope this helps.

Thanks and regards,

Anto.

Former Member
0 Kudos

Hi manish,

Hidding elements can be easily done if the UI elements are in different subforms.

U have not mentioned the subform name in which dropdown is present

am assuming it to

if ..,

DDLSubform

dropdown is hierarchy -


check object properties ...if binded to $record.dropdown

Then u can script as

if($record.dropdown == 1)

Page.Positions.P1 ="visible /hidden"

else

Page.Positions.P2 ="visible /hidden"

end if

hope helps.

Cheers

Swathi

Answers (0)