BusinessObjects Board

Evaluate variable expression - Java [BO XI 3.1]

Hi, according to my last post at https://bobj-board.org/t/135342 i have not found answer for the question:

“How to obtain the value of a document variable

Maybe i am wrong about document variables (i thought that it is possible to get their values).
Maybe you have to EVALUATE a variable to get its value??? If yes, how to do it? Can not find any apropriate function in ReportEngine SDK.

Thanks for advice.


bsok (BOB member since 2009-01-26)

Don’t know how to evaluate but know how to obtain cells values:

Report rep = doc.getReports().getItem("Report name");
XMLView xv = (XMLView) rep.getView(OutputFormatType.XML);
System.out.println(xv.getContent());

and then parse xv.getContent() to get interesting value.


bsok (BOB member since 2009-01-26)

Although I am replying to an older post, I figured this might be useful for some. bsok is correct, you need to evaluate the variable’s formula.

In VBA, you would use the evaluate method against the document variable’s .formula property.

Dim myDoc as Document
Dim myDocVar as DocumentVariables
Dim lVarResult as long
....
Set statements
...

lVarResult = myDoc.Evaluate(myDocVar.Formula,0)

Haven’t had the opportunity to get hands on with Java or .NET. I’m guessing the same method is available there as well.

Hope this helps.


vonwolf :us: (BOB member since 2002-10-21)