· Jul 27, 2021

Method Call

Hi all,
    We have a session values in a cache method and need to get those values in a client method (JavaScript).
Eg : 
    ClassMethod Method1()
    Set %session.Data("Param1")="Data 1"

ClientMethod onloadHandler [Language = javascript]
   var ret = zenPage.getSessionValues();

ClassMethod getSessionValues() As %String [zenMethod]
   Set Data = $G(%session.Data("Param1"))
   Quit Data

This is the code we implemented. But the problem is getSessionValues() method isn't called.
We need to know how to call a class method from client method.

Syed M

Product version: Caché 2017.1
$ZV: Cache for Windows (x86-64) 2017.2.2 (Build 867_4_20174U)
Discussion (1)1
Log in or sign up to continue

There appears to a confusion and understanding between a ClassMethod and a Method

your code ret=zenPag.getSessionValue()

looks like a Method as it is dependant on the object zenPage existing.

A ClassMethods can be called from anywhere thus must be identified in full

##class(ClassName).ClassMethod(Params if any)

getSessionValue must be a method with the zenPage Class structure.

You do not disclose the Class object that hosts the method1 of the onloadHandler so these may be ClassMethods

But Not the zenPage.getSessionValue() this defines a Method.