Post

2 followers Follow
0
Avatar

Formatting for Text Heading As Calculation

Hello!

In my apps, I have a series of headings that use the below code.

@Unique ID
var lrg = "800";
var hgt = "39";
var bg = "6686A6";
var ft = "FFFFFF";
var txt = "Basic Info";

"![](http://dummyimage.com/" + lrg + "x" + hgt + "/" + bg + "/" + ft + ".png&text=" + txt.toUpperCase() + ")"

Which gives me this

 

I want to be able to make one heading dynamic depending on a related item: deliverables.

In my Deliverables app, I have a text field called "Status Description" which changes depending on the status of the deliverable (Planning, external delivery, etc)

I have tried variations on the below, 

@Unique ID
var lrg = "800";
var hgt = "39";
var bg = "6686A6";
var ft = "FFFFFF";
var txt = "@All of Status Description with nulls";

"![](http://dummyimage.com/" + lrg + "x" + hgt + "/" + bg + "/" + ft + ".png&text=" + txt.toUpperCase() + ")"

 

however the field displays a string of numbers.

Is there any way to make this work?

Any help greatly appreciated.

Thank you! 

 

Jasha Andrews

Please sign in to leave a comment.

1 comment

0
Avatar

Hi Jasha, 
the numbers you get are the ids of the app and the field in that app you reference with @all of ... 

With @all of ... you get an array - that array you must parse to a string or you must pick one element out of the array to display it as text, number, date in the calculation field.  What you need is: 

var txt = "@All of Status Description";
var txt = txt != "" ? txt.toString() : "";

: "" means: if the field Status in Deliverables is empty show nothing; you can replace "" with any text like "no status selected"

Btw: Try dabuttonfactory.com instead of dummyimage - you can create nicer headings with less effort. 

Rainer

Rainer Grabowski 0 votes
Comment actions Permalink