*INSTANCE_OF #PRIM_XXXX on Web page

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
MegumiSawada
Posts: 45
Joined: Tue Mar 22, 2016 1:45 pm
Location: Tokyo, Japan

*INSTANCE_OF #PRIM_XXXX on Web page

Post by MegumiSawada » Thu Apr 13, 2017 5:11 pm

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

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: *INSTANCE_OF #PRIM_XXXX on Web page

Post by Stewart Marshall » Thu Apr 13, 2017 9:07 pm

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
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

MegumiSawada
Posts: 45
Joined: Tue Mar 22, 2016 1:45 pm
Location: Tokyo, Japan

Re: *INSTANCE_OF #PRIM_XXXX on Web page

Post by MegumiSawada » Fri Apr 14, 2017 10:23 am

Hi Stewart,

I see, thank you.

Best Regards,
Megumi

dannyoorburg
Posts: 157
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

Re: *INSTANCE_OF #PRIM_XXXX on Web page

Post by dannyoorburg » Fri Apr 14, 2017 11:52 am

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

MegumiSawada
Posts: 45
Joined: Tue Mar 22, 2016 1:45 pm
Location: Tokyo, Japan

Re: *INSTANCE_OF #PRIM_XXXX on Web page

Post by MegumiSawada » Fri Apr 14, 2017 12:45 pm

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

dannyoorburg
Posts: 157
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

Re: *INSTANCE_OF #PRIM_XXXX on Web page

Post by dannyoorburg » Fri Apr 14, 2017 12:58 pm

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

MegumiSawada
Posts: 45
Joined: Tue Mar 22, 2016 1:45 pm
Location: Tokyo, Japan

Re: *INSTANCE_OF #PRIM_XXXX on Web page

Post by MegumiSawada » Mon Apr 17, 2017 11:22 am

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

dannyoorburg
Posts: 157
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

Re: *INSTANCE_OF #PRIM_XXXX on Web page

Post by dannyoorburg » Tue Apr 18, 2017 2:20 pm

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

Post Reply