Argument | Description | Types / Required |
logic | The logic statement(s). | string
required |
As of CSPro 8.0, the full compiler is not available at runtime and thus the action can only call execute
user-defined functions that use
numeric and
string parameters. This limitation also means that only numeric constants and string literals can be passed as arguments to the CSPro function. This limitation will be removed in a future version.
Because logic functions can display UI elements, it is a good idea to use the
asynchronous version of this action when using this action from a
web view.
User-defined functions can also be executed at runtime using the
Logic.invoke action and the
invoke function.
The action returns the result of the last statement as a number or string.
The action throws an exception if any of its arguments are not specified in a valid form or if there is an error compiling the logic.
This example uses the asynchronous version of
Logic.eval to ensure that the UI elements of the
Report.view function call are displayed correctly.
<h1>District Reports</h1>
<p>Select a province or district report to view:</p>
<ul>
<li><a href="#" onclick="showDistrictReport(1); return false;">Artesia</a>
<ul>
<li><a href="#" onclick="showDistrictReport(1, 1); return false;">Dongo</a></li>
<li><a href="#" onclick="showDistrictReport(1, 2); return false;">Varda</a></li>
</ul>
</li>
</ul>
<script>
const CS = new CSProActionInvoker();
function showDistrictReport(province, district) {
CS.Logic.evalAsync({
logic: `ShowDistrictReport(${province}, ${district ? district : "notappl"});`
})
.catch(e => {
CS.UI.alertAsync({
text: e.message
});
});
}
</script>
The logic function that is called by the above JavaScript: