Time in String Writable

New here and my first post. A question I am trying display only seconds on a px page without any decimal places. I reviewed the BFormat Cheat Sheet and tried a few different things but it did not work (%out.Minute%)

The program object is Boolean Delay With Time, Time Reamaing Output to a String Writable which converts the display from seconds to ms.

image

Reference: BFormat Cheat Sheet - Tridium Niagara - ddc-talk community

1 Like

First of all, welcome @mreining :slight_smile: . To answer your question:

In you’re case you are BFormatting the object type of BRelTime. When we look at the bajadoc for BRelTime we can see all the methods available to us. As a general rule when using BFormat we can use any methods that begin with get, do not take any arguments and are not void.

For Example:

In BFormat we simply drop the get and () and use camel case. For example:

If we want to return just the seconds part, we can see in the bajadoc we have the method getSecondsPart() which in BFormat would equate to %secondsPart%.

When we look at the slot sheet for the BBooleanDelayWithTimer we can see the slot type for timeRemaining (this is how me know what type to lookup in the baja doc and what methods we can use):

So to form the BFormat we must use the component name (slot) then the method we want. %timeRemaining.secondsPart%

Hope this helps :smiley:

1 Like

That description on how to use the Niagara API docs for accessing methods wihtin a BFormat string is awesome! Thank you for posting that.

I noticed, though, that the intial question mentions the slot whose value he wants to display is from a ProgramObject and his image shows decimal places where a BRelTime doesn’t appear to show decimal places (by default) when linked to a String slot.

So, I am wondering if his source slot is a String or StatusString.

If so, you may want to use the KitControl String manipulation objects to parse the String value into what you want.

image

image

image

And we may be able to do this fully within the Label widget’s animated text property ike this:

%out.value.substring(0,2)% secs

I suspect there are even cooler ways to do this and hope others post them here.

And please don’t hesistate to let me know if I have this all totally wrong or misunderstaood the question.

1 Like

Thanks, @Eddie! You’ve made some excellent points. @mreining, if you’re okay with it, could you share a snippet of your program object and code? That would help us understand your context better.

Given that you’re working with a program object, it might be more efficient to to adjust the code to output the format that you’re looking for.

Thanks for the information. I was unable to use the BFormat as posted. The boolean delay with timer displays (axcommunity or vykon block not sure) is correctly but when linked to the px page in a bound label is shows the seconds to the thousands.

image

It is a BRelTime then. But you can cast it as a String (link it to a string object like a StringWritable) then treat it as a String after that.

Or, you can adjust the facets in the timer w delay object to a precision of 0.

image

image

image

The Ord in the binding should go all the way to the Time Remaining slot.

Set the animated Text property in the label to %.% to grab the whole value of that slot.

image

image

image

I love Niagara because I truly believe that there is always a way!

1 Like

I suspect there are even cooler ways to do this and hope others post them here.

I present to you, the only sane way to visualize numbers in niagara!

In this example, I will stick to the seconds part, as you made some beautiful logic to filter that.

Start by binding your seconds to an Equal block, for each second in a minute:

Make some beautiful numbers on a px page and display them only of an equal block is true

Dazzle your customers with stunning numbers, that sometimes renders correctly.

wb_DRjC7si5D7

Disclaimer to anyone reading this reply: This is useless garbage. Don’t do like i did, unless you are mentally unstable!

1 Like

That binding of seconds seems a lot like something I had to do to get a Boolean Delay Block to work. I had to pass the input (min), multiply by 60,000 to get milliseconds, which is the only input the “Off Delay” the Boolean Delay Block would take.