Skip to main content
Question

How do I simplify this formula


Forum|alt.badge.img+7
My formula is working, but can I make the formula shorter or just simple.


var text URL = URLRoot() & "db/" & [_DBID_PROJECTS] & "?a=dr&rid=" & [Related Project - From Job] & "&dfid=17"& Rurl();
var text URLL = URLRoot() & "db/" & [_DBID_PROJECTS] & "?a=er&key="& [Related Project - From Job]&"&dfid=17";


If( [# of Projects - Building Forms]=1,
"<a style='text-decoration:none; font-weight:bold' class='Vibrant Success' href='" & $URL & "'>Open Form</a>",
"<a style='text-decoration:none; font-weight:bold' class='Vibrant Success' href='" & $URLL & "'> Send Form</a>"
)
This topic has been closed for replies.

The formula look very readable to me.  I would not try to make it shorter but more complicated.

Hi Shontay,

I'm not sure if this shortens the code, but it may make it a little more readable. By adding more variables it also makes it easier to update the code in the future (e.g. adding more lines of code or making adjustments).

Let me know if this helps!




var text urlRoot = URLRoot() & "db/";
var text projTbl = $urlRoot & [_DBID_PROJECTS];

var text openUrl = $projTbl & "?a=dr&rid=" & [Related Project - From Job] & "&dfid=17" & Rurl();
var text sendUrl = $projTbl & "?a=er&key="& [Related Project - From Job] & "&dfid=17";

var text open = "<a style='text-decoration:none; font-weight:bold' class='Vibrant Success' href='" & $openUrl & '>Open Form</a>";
var text close = "<a style='text-decoration:none; font-weight:bold' class='Vibrant Success' href='" & $sendUrl & "'> Send Form</a>";

If([# of Projects - Building Forms] = 1,
$open,
$close)