cancel
Showing results for 
Search instead for 
Did you mean: 

Hide/View image

Former Member
0 Kudos

Hello everyone,

I'm a newbie in relation to Interactive forms, and i'm having some problems realizing how to do things.

I have an ImageField mapped to a variable on webdynpro with respective URL. This works fine. What i wanted was to show a StaticImage i have (a jpeg that says "No photo available") and make it visible in case the field URL returned from webdynpro is null.

I tried something like this:

if (Form1.ImageField1.value == null) then

Form1.ImageField1.presence = "hidden"

Form1.StaticImage1.presence = "visible"

else

Form1.ImageField1.presence = "visible"

Form1.StaticImage1.presence = "hidden"

endif

but i'm not getting anything. Can someone please help me?

Thank you in advance,

Nuno Santos

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

if ( Subform11.NumericField5.value == "-1" ) then

Subform11.NumericField5.presence = "hidden"

Subform11.presence = "hidden"

else

Subform11.NumericField5.presence = "visible"

Subform11.presence = "visible"

endif

OR

Intialization event should work.

RawValue contains before formated value.

Scenario 1 : Depending on a specific value a field has to be hidden.

a) Select the field you want to hide depending on a condition. (On the layout designer)

b) Choose ‘FormCalc’ as language and ‘Form:Ready’ as event. (On the script editor)

c) Scripting:

if ( $.rawValue == .presence = “hidden”

endif

Might this will helps you.

Thanks

Lohi.

Former Member
0 Kudos

I still don't get it. Sorry. I must be missing something on the syntax of FormCalc. I'll try and explain here the exact components i'm using in the form:

The name of the form is AnualForm

- StaticImage1 exists on hierarchy AnualForm->Form1->StaticImage1

- ImageField1 exists on hierarchy AnualForm->Form1->ImageField1

Static Image is mapped to "nophoto.jpg" mime file.

Image Field is mapped to URL returned by $record.Identification.PHOTO

the behaviour i want is:

IF URL returned by SAP = null THEN

Image Field = "hidden"

Static Image = "visible"

ELSE

Image Field = "visible"

Static Image = "hidden"

ENDIF

With these elements, can someone please explain what code do i have to put and where ??

Thank you,

Nuno Santos

PS - Other question:

In this line

$.<exact path to the object we want to hide>.presence = “hidden”

what is the "exact path to object"? When i use the "$" symbol i can't get any auto-complete to that path.

Message was edited by:

Nuno Santos

Former Member
0 Kudos

Hello Nuno,

I created a small test form (standalone, i.e. without web dynpro) and added the following (FormCalc) script to the "form:ready" event of ImageField1:

[code]if($.isNull) then

$.presence = "hidden"

else

$.parent.StaticImage1.presence = "hidden"

endif[/code]

When the appropriate XML tag of the provided data was empty (e.g. <PHOTO/>), the static image was shown, when it contained the image raw data (base64-encoded) instead, the image field was present in the output...

Regards,

Philipp

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Try this script on the field in formcalc.

If ( $.isNull ) then

$.presence = "hidden"

else

$.presence = "visible"

endif

or

write this code on superior subform.

If ( $.<FIELD>.isNull ) then

$.presence = "hidden"

else

$.presence = "visible"

endif

provided the subform should be in flowcontent

Hope this helps you.

Thanks and regards,

kris

Former Member
0 Kudos

Hi,

I have sample scripts that may help you...

<b>// Java Script...</b>

<i>if($record.CONTROL_PARAM.ISR_MODE == "CHANGE" )

then

this.presence = "invisible"

else

this.presence = "visible"

endif</i>

<b>// Formcalc script</b>

<i>// Check for a null - an empty XML node will return a null

if ($.rawValue <> null) then

CurrValue = $.rawValue

endif</i>

Hope these are relevant to your current problem.

Regards,

<i><b>Raja Sekhar</b></i>

null