I am working on a BIRT
Report and one of the fields contains the following expression:
dataSetRow["user_id"] != dataSetRow["creatorId"] ? dataSetRow["orderCreator"] : ''
What is the logic of this statement?
I am working on a BIRT
Report and one of the fields contains the following expression:
dataSetRow["user_id"] != dataSetRow["creatorId"] ? dataSetRow["orderCreator"] : ''
What is the logic of this statement?
That statement is the equivalent of the code below, and is called the 'ternary' operator:
var value;
if(dataSetRow["creatorId"]){
value = dataSetRow["orderCreator"];
}
else{
value = '';
}
//To be clear, this isn't assigning to anything - this is the same expression you have in your question.
dataSetRow["user_id"] != value
You could use that expression, which returns a boolean, in an if
block, for example:
if(dataSetRow["user_id"] != value){
//Do something
}