Passing params to function in global, INTERSYSTEM CACHE

321 views Asked by At

I have a problem. I can't find a way to pass parameters to the function, inside teh Global:

set ^SERIES(1)="Nombre de Serie#Humor#10#Do ResultadoSerie^KDAobjetos(respuesta)" ..... CargaMenu1 ; New Sql,Statement,status,resultSet,resultado,mensaje

Set Sql="select * from SQLUser.Series"

Set Statement=##class(%SQL.Statement).%New()
Set status=Statement.%Prepare(Sql)
If status=1
{       
    Set resultSet=Statement.%Execute()
    While resultSet.%Next()
    {
        Use 0 Write $J(resultSet.IdSeries,5)_".- "_resultSet.NombreSerie,!
    }
}
else 
{
    // No se ha podido ejecutar la consulta.
    set resultado=-1
    set mensaje=$$STATUSERROR^SPAHH000(status)
    Use 0 Write resultado_" : "_mensaje,!
}

// Condicion de salida
Use 0 Write !,$J(0,5)_".- Salir",!
W !,""

Quit 

CargaMenu2(respuesta) New objSerie,status set objSerie = ##class(User.Series).%OpenId(respuesta,,.status) If status = 1 {

    Xecute objSerie.XecuteCode(respuesta)

 }
else
{
    W !,""
    Use 0 write "OpciĆ³n no disponible.",!   
    hang 2
}
Quit

ResultadoSerie(respuesta) ; set objSerie = ##class(User.Series).%OpenId(respuesta,,.status) W #,"La serie "objSerie.NombreSerie", es de "objSerie.CategoriaSerie" y tiene "objSerie.TemporadasSerie" temporadas." W !!, "" hang 2

    Quit

Terminal Result :

<OBJECT DISPATCH>Function2+9^CargaMenu2 *Property 'XecuteCode' in class 'User.Serie' is not MultiDimensional
USER 3d1>
1

There are 1 answers

1
DAiMor On

Even after update, still does not explain why you need it this way. It's not very good to execute this way some code stored somewhere in the database. I would recommend finding another way.

Anyway, you have to construct the correct string, with all the parameters inside, and execute it. And loot to the documentation. Maybe you'll find a better answer.