Hello Dojo !
I am using this piece of code to parse a correlation alarm info, The last 3 lines inside the curly brackets prints out all the properties associated with that correlated alarm , some of the properties printed do not have a value and just prints statements. I wanted to remove some of those prints which return no value. Is there any way to block some properties from printing in the information event console ?
For example, I would like to remove the red marked properties if possible. Any help or suggestion will be appreciated.
Kind Regards
A B M
Hi,
Property values are strings. In this case a possible solution could be printing only the properties where the value is different from empty. For example:
for (int i=0; int < amountProperties; i++) {
string propertyName = parts[21 + i*2];
string propertyValue = parts[21 + i*2 + 1];
if(!string.IsNullOrEmpty(propertyValue)){
engine.GenerateInformation("Property:" + propertyName + " == " + propertyValue);
}
}
Hope it helps.
Hi,
Sorry for the confusion. I updated the answer. Basically you can use the same piece of code that you have in your example to generate the information event.
Hi tried this piece of code with an alarm simulator , the output seen is a bit weird. The script starts once and keeps on executing a few time to find the property but does not print the properties I need and performs the specific action 5 times for a single alarm (unnecessary)
I would prefer “IsNotNullOrNotEmpty(propertyValue)” if there is something like this ?
Hi,
Sorry, I updated the answer. I forgot to include the ‘not’ operator which is the exclamation mark.
it should be if(!string.IsNullOrEmpty(propertyValue))
Hi could you please elaborate what should I add in the ” // print something ” because if property value is null , I don’t want to print anything ? sorry if I sound confusing