Page 1 of 1

*INSTANCE_OF #PRIM_XXXX on Web page

Posted: Thu Apr 13, 2017 5:11 pm
by MegumiSawada
Hi

Can we use If_Ref Is(*INSTANCE_OF #PRIM_XXXX) on Web page?

I have used the following logic for the web page, but all the item name is shown on the message box even though none of them are using #PRIM_PANL.

Code: Select all

For Each(#ITEM) In(#COM_OWNER.ComponentMembers)
If_Ref Com(#ITEM) Is(*INSTANCE_OF #PRIM_PANL)
#MSGBOX.CAPTIONS.ADD Caption(#ITEM.NAME)
Endif
Endfor
When using a form, message box shows no captions.
Does this mean that we cannot use *INSTANCE_OF #PRIM_XXXX on the web page?

I appreciate your kind advice.
Best Regards,
Megumi

Re: *INSTANCE_OF #PRIM_XXXX on Web page

Posted: Thu Apr 13, 2017 9:07 pm
by Stewart Marshall
Hi Megumi

The behaviour should be the same in both Forms and WebPages

If not, this is a bug and should be reported to your regional helpdesk

Regards

Re: *INSTANCE_OF #PRIM_XXXX on Web page

Posted: Fri Apr 14, 2017 10:23 am
by MegumiSawada
Hi Stewart,

I see, thank you.

Best Regards,
Megumi

Re: *INSTANCE_OF #PRIM_XXXX on Web page

Posted: Fri Apr 14, 2017 11:52 am
by dannyoorburg
Hi Megumi,

As a workaround, use the For commands Operation parameter instead.

http://docs.lansa.com/14/en/lansa015/in ... .htm#FOR_P

It can do INSTANCE_OF as well...

Cheers,
Danny

Re: *INSTANCE_OF #PRIM_XXXX on Web page

Posted: Fri Apr 14, 2017 12:45 pm
by MegumiSawada
Hi Danny,

Thank you for your advice.
Do you mean it looks like this?

Code: Select all

For Each(#ITEM) In(#COM_OWNER.ComponentMembers) Operation(*INSTANCE_OF #PRIM_PANL)
* If_Ref Com(#ITEM) Is(*INSTANCE_OF #PRIM_PANL)
#MSGBOX.CAPTIONS.ADD Caption(#ITEM.NAME)
* Endif
Endfor
#MSGBOX.SHOW
It seems it returns the same result as If_Ref...

Best Regards,
Megumi Sawada

Re: *INSTANCE_OF #PRIM_XXXX on Web page

Posted: Fri Apr 14, 2017 12:58 pm
by dannyoorburg
Yes. That's what I meant.

And I was pretty sure that works.... hmm.

Not working today so I can't try. I'll get back to you.

Danny

Re: *INSTANCE_OF #PRIM_XXXX on Web page

Posted: Mon Apr 17, 2017 11:22 am
by MegumiSawada
Hi Danny,

Thank you. please enjoy the rest of Easter holidays.

Dom from LANSA support provides the workaround this issue as follows:

Code: Select all

If (#ITEM *IsOfType #PRIM_PANL)
#MSGBOX.CAPTIONS.ADD Caption(#ITEM.NAME)
Endif
It works as expected and I will provide this to the customer as a workaround for now.

Thank you!
Best Regards,
Megumi

Re: *INSTANCE_OF #PRIM_XXXX on Web page

Posted: Tue Apr 18, 2017 2:20 pm
by dannyoorburg
Hi Megumi,

I managed to have a look at your sample. There's a bit more to it.

All these versions of INSTANCE_OF testing all do the right thing, the only problem is that EVP's (field visualizations) inadvertently inherit from PRIM_PANL in the Web Runtime.

THAT is the defect that will need fixing. PRIM_EVP inherits from PRIM_CTRL, not PRIM_PANL.

The *IsOfType operator DOESN'T solve the problem. *IsOfType is a different operator with slightly different semantics, as in:

Code: Select all


If_Ref Com(#ITEM) Is(*INSTANCE_OF #PRIM_PANL)

   * is true if #ITEM is a PRIM_PANL or INHERITS from PRIM_PANL
   
Endif

If (#ITEM *IsOfType #PRIM_PANL)

   * is true if #ITEM is a PRIM_PANL, NOT if it INHERITS from PRIM_PANL

Endif
It just changes the code so it looks like it solves the problem, I can't imagine it'll help you achieve what it is you're trying to achieve.

Cheers,
Danny