Published on InterSystems Developer Community (https://community.intersystems.com)

Home > %session.Data with unlimited amount of indexes

Discussion
Dmitry Maslennikov · Nov 9, 2020

%session.Data with unlimited amount of indexes

Let's imagine you have to implement a method with a definition

/// Set value to %session.Data
ClassMethod setValue(params...) As %Status
{
}

How it should work

do ..setValue("key1", "val")

is equal to

set %session.Data("key1") = "val"

and 

do ..setValue("key1", "key2", "key3", "key4", "val")

is equal to 

set %session.Data("key1", "key2", "key3", "key4") = "val"

so, quite simple, any amount of arguments, while the latest one is a value, and any previous is an index, should accept at least 2 arguments.

 

How would you implement this method?

#Beginner #ObjectScript #Tips & Tricks #Caché #InterSystems IRIS

Source URL:https://community.intersystems.com/post/sessiondata-unlimited-amount-indexes