Real'sHowTo AddThis Feed Button
Custom Search

Evaluate an expressionTag(s): Powerscript


The datastore can be useful to evaluate a numerical expression at run-time. Simply create a minimal datastore and evaluate the expression.
datastore lds_temp

string ls_result
string ls_expession

string ls_err
// a dummy minimal datastore definition
string ls_dsdef = &
'release 6; datawindow() table(column=(type=char(255) name=a dbname="a") )'

lds_temp = CREATE datastore
lds_temp.Create(ls_dsdef, ls_err)
lds_temp.InsertRow(0)

IF Len(ls_err) > 0 THEN
   MessageBox("ds create", ls_err)
ELSE
   ls_expression = "(2 + 7)  / 3"
   ls_result = &
     lds_temp.Describe ( 'evaluate( " ' + ls_expression + ' " ,1)' )
   MessageBox("ds evaluate", ls_result)
END IF
DESTROY lds_temp

blog comments powered by Disqus


If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2014
[ home ]