Skip to main content

Can anyone help with a syntax to insert a href value (see emphasis below) in a form calculated value formula? Not much luck with the following:

If(Status=="Assessment completed", "This assessment form has been completed and can no longer be edited. A <a href=""Site URL/Documents/Assessment-ID-Submitter.docx"">copy of this assessment</a> is also available in Microsoft Word format.", If(Status=="Closed", "This assessment form has been closed and can no longer be edited.", If(Status=="Cancelled", "This assessment form has been cancelled and can no longer be edited.")))

Have a look on this https://community.nintex.com/message/56581-re-add-variable-to-url-on-nintex-form?commentID=56581#comment-56581 

At first,  there is a problem with if() syntax in your formula. if() for cancelled status miss an outcome for negative condition result.

At second, if you use references/variables in a formula (site url, id, submitted, ...), they have to be placed out of string content so that they get evaluated and aren't taken  literally


I've already had a look at the example you posted. I'm not good with programming syntax, and still don't know how to get your syntax to work correctly in my context. Any help would be appreciated.

The nested if rules work already work correctly if I do not include the href portion.


Furst Lars‌, Marian Hatala‌'s point about your incorrect if() statement for the Cancelled status is that you're missing the False or Negative outcome. Each if() statement needs three things: test, true outcome, and false outcome.

If(
    Status=="Cancelled",
    "This assessment form has been cancelled and can no longer be edited.",
    {You're Missing the False outcome of this If statement.}
)‍‍‍‍‍

Also, notice I've added a comma to the end of line 3. If you don't want anything to be returned when the Status is not equal to Cancelled at this point, you could just place empty quotes '' in the third section.

However, if the only possible options for Status are "Assessment completed", "Closed", and "Cancelled", you could just skip the last if() and do this in the Status=="Closed" if():

If(
    Status=="Closed",
    "This assessment form has been closed and can no longer be edited.",
    "This assessment form has been cancelled and can no longer be edited."
)

Now, as for your initial question regarding creating a dynamic URL in a Calculated Value, here's what you're going to need:

"This assessment form has been completed and can no longer be edited. A <a href='" + Site URL + "/Documents/Assessment-" + ID + "-" + Submitter + ".docx' target='_blank'>copy of this assessment</a> is also available in Microsoft Word format."‍‍

See how I've broken the references/variables out of the string? The + sign will concatenate your values together. 

I did replace your escaped quotations with single quotes, but that's simply personal preference. I also added in a target='_blank' so it uses a new tab to direct the user to the document rather then replacing their current form page.

I can be a little difficult to try and wrap your head around building a string of text and variables, but with practice you'll get the hang of it.


Reply