More Conditional Text Options

Brandon - District Photo's Avatar

Brandon - District Photo

02 Dec, 2016 04:28 PM

Here's my scenario:

I have signature text that goes on prints if the customer orders it, I have it setup like this:

{@Portraits|@Firstname}
{@Portraits|2016-2017}

This says, if there's data in the Portraits field, my template will pull text from the Firstname field, and below it will add the text 2016-2017. Now what I want to do is customize my year text however I want (some customers just want 2016, some want 2017), BUT, default back to 2016-2017 if there's no customized year data.

So I can do this:
{@Portraits|@Firstname}
{@Portraits|@Year}

This is a pretty doable scenario, as I could make a Year file field and a Year subject field, put the default text on the file field, and customize what I want on the subject level.

I can do this:
{@Portraits|@Firstname}
{@Year|@Year|2016-2017}

In this scenario, I can customize the year column how I want, and if it's empty, it will default back to 2016-2017, but this will be applied for every subject.

What I want to do, but can't:

{@Portraits|@Firstname}
{@Portraits|@Year|2016-2017}

This says, if there's data in the portrait field, then populate text from the Year field, if not, populate the text 2016-2017.

This is a true IF/THEN/ELSE statement, and I can think of a lot of applications this functionality would be useful.

  1. 1 Posted by Jacob - Sumner ... on 02 Dec, 2016 10:26 PM

    Jacob - Sumner Photography's Avatar

    If I'm following what you're after, this {@Portraits|@Year|2016-2017} should work according to:
    http://www.timestone.com.au/help/help/tenderkb.html

    I've tested this locally (copy and pased what you'd typed above and made the fields) on 4.6.160902 (current) and it works as expected. What I would check is to make sure there aren't any duplicate fields, like a "year" or "package" folder\file field that might be interfering.

    If you're looking for nested fields, it's complicated. Something like this works:
    {@portraits|@year|{@year2|@year2|2017} because the condition is in the "else" position. ( {if|then|else} ) What you can't do is this: {@portraits|{@year|@year|@DefaultYear} which is putting a condition in the "then" position. That said, you can do some really cool stuff with this and we're using it on a number of templates.

    With all of this, syntax has to be 100% PERFECT, otherwise it doesn't work and won't tell you why it's broken.

  2. 2 Posted by Brandon - Distr... on 03 Dec, 2016 11:39 AM

    Brandon - District Photo's Avatar

    So when you copy my formula, if the @Year field returns false, it defaults to 2016-2017? Because for me, it doesn't default to anything and just shows an empty field. It does return any data that I put in the @Year field, however.

    I've tried this in multiple scenarios, and have never gotten it to work. I'm on the current version.

  3. 3 Posted by Jacob - Sumner ... on 10 Dec, 2016 12:31 AM

    Jacob - Sumner Photography's Avatar

    Yes. Here's the test template I've made. Works as-advertised.

    Also, I would recommend making a new, single subject, job. Keep it as vanilla as possible, and testing this out there. The less that can go wrong the better.

  4. 4 Posted by Brandon - Distr... on 14 Dec, 2016 02:12 PM

    Brandon - District Photo's Avatar

    So here's what your template does for me:

    When I have a character in the Portraits field, it will return ONLY what's in the Year field. If there's nothing in the Year field, it returns nothing. Only if there's nothing in the Portraits field, will it default to 2016-2017.

    I'm sure this is working as intended, but I was hoping it would function a little differently. What I need:

    If a character is in the Portraits field, it should return the Year field, but if there's nothing in the Year field, it should return 2016-2017.

    In my scenario, the Portraits field would be the switch that turns the text on or off, and the Year modifies what the text returns. How it currently is, when the Portraits field is "on", it returns whatever is in the Year field, when it's "off" it returns the default text 2016-2017. This would be fine, except it doesn't work well with my other expression {@Portraits|@Firstname}.

  5. 5 Posted by Jacob - Sumner ... on 14 Dec, 2016 09:24 PM

    Jacob - Sumner Photography's Avatar

    Ah, yes. I understand now.

    What you want is {@portraits|{@year|@year|2016-2017}

    Unfortunately you can't nest a condition in the "then" slot.

    Now, I'm thinking that if you're using the @year subject field that you need to use it right? So why not just use @year for the trigger. If it exists use it, if it doesn't then use the default value. Like this {@year|@year|2016-2017}

    You could also make it a little smarter and do this
    {@year|@year|{@portraits|2016-2017|} That would make the default value only show if there's something in @portraits, or blank if it was without (because you can nest conditions in the "else" field).
    So that's like halfway there.

  6. Support Staff 6 Posted by Tommi Jonasson on 15 Dec, 2016 01:43 AM

    Tommi Jonasson's Avatar

    I just had the same moment of clarity reading that last message. Jacob is spot on about the nested conditions, so nothing to add there really. More options and power when it comes to conditional text and labels is certainly worth a spot on the wishlist.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac