Arrays

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
soa
Posts: 339
Joined: Mon Dec 07, 2015 3:15 pm

Arrays

Post by soa » Mon Sep 30, 2019 6:47 pm

VLWEB allows me to define a collection like

Define_Com Class(#prim_lcol<#WRK3A>) Name(#MKS)

Where #WRK3A is a simple Dictionary *CHAR 3

But I can't work out how insert an entry

#MKS.Intert(#WRK3A) doesn't work (not a component)

Is there a way to achieve a simple string array?

Pablo
Posts: 48
Joined: Wed Dec 02, 2015 10:35 am

Re: Arrays

Post by Pablo » Mon Sep 30, 2019 11:24 pm

Hi soa,

Define_Com Class(#prim_lcol<#std_code>) Name(#MKS)

#mks.Insert Item(*New #std_code)
#mks.Last := "123"

#mks.Insert Item(*New #std_code)
#mks.Last := "345"

For Each(#item) In(#MKS)

#sys_web.Alert Caption(#item.Value)

Endfor

https://docs.lansa.com/14/en/lansa016/prim_lcol.htm

Regards,
Pablo

René Houba
Posts: 86
Joined: Thu Nov 26, 2015 7:03 am

Re: Arrays

Post by René Houba » Mon Sep 30, 2019 11:39 pm

Hi soa,

Define_Com Class(#prim_lcol<#WRK3A>) Name(#MKS)
Define_Com Class(#WRK3A) Name(#FIELD_WRK3A)

#MKS.Insert Item(#FIELD_WRK3A)


Kind regards,
René

soa
Posts: 339
Joined: Mon Dec 07, 2015 3:15 pm

Re: Arrays

Post by soa » Tue Oct 01, 2019 9:34 am

Thanks for the help guys!

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

Re: Arrays

Post by dannyoorburg » Tue Oct 01, 2019 10:25 am

Beware of the last one though.... You have to understand that prim_lcol stores object references and it has no problem with storing multiple references to the same object.

Which makes for some interesting side-effects if that's not what you meant.

Cheers,
Danny

Post Reply