Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

ValueAtTime and FormatFloat in RTMC Table


Clayton Dec 20, 2011 10:02 PM

Is it possible to use FormatFloat on a ValueAtTime within a table display in RTMCpro? I've got the ValueAtTime expression working fine, but I can't figure out the syntax for rounding that value to the nearest single digit.

Thanks,
Alex


jtrauntvein Dec 20, 2011 11:24 PM

Assuming that I understand your question, here is an example that uses the alias() function to simplify the expression:

Alias(value, "src:station.table.value");
FormatFloat(
ValueAtTime(value, timestamp(value), nsecPerDay, 0),
$"%.0f"))

* Last updated by: jtrauntvein on 12/22/2011 @ 10:25 AM *


Clayton Dec 21, 2011 11:24 PM

I've only been able to get alias to work in digital displays, never in a table display. I've tried the actual value name as well as the "original value" that is in the manage columns window of the table display.

So, since alias doesn't seem to work in tables, I got this working:

FormatFloat(ValueAtTime("WindSpd",TimeStamp("WindSpd"),
TimeStamp("WindSpd") MOD nSecPerHour,6999),$"%0.0f")

But when I tried to extend this formatting to a rather complicated IIF expression, it didn't work. Oddly, it did work with ROUND, which will have to do. It would be perfect if round actually removed the trailing zeros the way it indicates in the on-line help.

I've commented on this before, but it bears saying again; it sure is frustrating that all of the elements of of RTMC don't use the same syntax for expressions.


jtrauntvein Dec 22, 2011 05:25 PM

I'm sorry, I did not notice in your original post that you were using the table display. I also noticed that I had forgotten to add a '$' before the format string in my example.

Try replacing $"0.0f" with $".0f".


Clayton Dec 22, 2011 11:18 PM

Yes, I noticed the lack of a $ and just figured you left it out by mistake. That's not the problem and I've tried both $"%0.0f" and $"%.0f" and it doesn't seem to make any difference. Did you mean to leave the % out of your last post?

Log in or register to post/reply in the forum.