Article
· Jan 5, 2016 1m read

Nifty COS syntax - set $listbuild(multiple,variables) = list

(Possibly?) little-known fact: It's possible to use $ListBuild on the left hand side of the equals sign in a set command to extract multiple list values at once:

set $ListBuild(several,individual,variables) = list

 

For example:

USER>kill
 
USER>set colors = $ListBuild("red","orange","yellow")
 
USER>set $ListBuild(r,o,y) = colors
 
USER>write r,!,o,!,y,!
red
orange
yellow

 

See for reference: http://docs.intersystems.com/cache20152/csp/docbook/DocBook.UI.Page.cls?...

This feature was news to me - I use $ListBuild lists a lot but hadn't come across it until today. Had anyone else encountered this?

Discussion (4)1
Log in or sign up to continue