Transformations Scripts for table DCI
-
Hi,
NetXMS is a very good programm, i think.
I´ve the following problem with transformation scripts of table dci´s: For example i have a dci named voltage. In this DCI there are three colums: description (string), voltage (integer) and the status (string).
Unfortunally the voltage is with factor 1000 and the status is orgininal an integer (f. ex. 3 = is okay)
Now I want to transform the voltage to the real value (1200 to 1,2) and the status value to an status text (3 = OK).
I have transformation scrips for "simple" parameters - they are working. But they don´t work with table dci.
So I want to ask for help and for an example. Thanks a lot. -
Hi!
It could looks like following:
idxVoltage = $1->getColumnIndex("VOLTAGE"); idxStatus = $1->getColumnIndex("STATUS"); for(i = 0; i < $1->rowCount; i++) { $1->set(i, idxVoltage, $1->get(i, idxVoltage) / 1000); if ($1->get(i, idxStatus) == 3) { $1->set(i, idxStatus, "OK"); } }Best regards,
Victor -
Hi Victor,
thank you so much. I guess, I never match the solution for my problem by myself...
Your solution works fine. -
I try to do same.
But result is not set correctly (snmp value is set in place of calculated value).
Screenshot in attach.
transformation script:Percnt = getColumnIndex("StorageUsedPercent"); Used = getColumnIndex("hrStorageUsed"); Size = getColumnIndex("hrStorageSize"); for (i = 0; i < $1->rowCount; i++) { if ( $1->get(i, Used) > 0 && $1->get(i, Size) > 0 ) { $1->set(i, Percnt, ($1->get(i, Used) / $1->get(i, Size) * 100) ); } else { $1->set(i, Percnt, 0 ); }Also I have noticed, that there are no any notification if table colums set not right.
How to set Dummy column?
-
-
Hi!
getColumnIndex is a method of Table class, so you should use it as $1->getColumnIndex in transformation script, like you do with get method.
Best regards,
Victor
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login