Create a list of messages in studio
Do you have any clue how to create a list of messages in studio ?
Example :
I can define one message that is called DoctorInfoMsg such as
Property UserName As %String;
Property ListOfPatients As list Of %String;
How to define a list of PKGNotification.InDoctorInfo messages ?
How to get UserName of the first message?
Comments
Working with collection properties documentation.
If you want to hold a list of objects at runtume, use %ListOfObjects.
If you want to store a list of objects use collection properties (as you use ListOfPatient).
Thank you Eduard.
To clarify, I don't have a problem with defining the properties in a message.
My question is how to define a list of messages. What's the syntax ?
Unfortunately, I couldn't find my answer in this documentation.
I want something similar to
set mylist=##class(%ListOfDataTypes).%New()
But instead of ListOfDataTypes I want List of DoctorInfoMsg
Thanks again :)
Property DoctorInfos As list Of PKGNotification.InDoctorInfo;?
Thank you so much
Hi Ali,
Here is a sample of using %ListOfObjects:
SAMPLES>set list=##class(%ListOfObjects).%New()
SAMPLES>set t1=##class(HoleFoods.Transaction).%OpenId(1)
SAMPLES>d list.Insert(t1)
SAMPLES>w list.Count()
1
SAMPLES>set t2=##class(HoleFoods.Transaction).%OpenId(2)
SAMPLES>d list.Insert(t2)
SAMPLES>w list.Count()
2
SAMPLES>w list.GetAt(1)
2@HoleFoods.Transaction
SAMPLES>w list.GetAt(1).%Id()
1
SAMPLES>w list.GetAt(2).%Id()
2
SAMPLES>w list.GetAt(2).AmountOfSale
6.95
Thank you so much.
Creating a list of objects instead of list of a specific type of messages is a good option