ChatGPT vs. Appster: How to conditionalize a <<START: >> inside a template so it doesn't show if there's no records

I regularly make comparisons to check that the pro version of Appster (the one in the Answer Portal) is providing more quality answers than AppsterGPT, and certainly better than vanilla ChatGPT. :muscle:

  • Vanilla ChatGPT shouldn’t be that good, it doesn’t have any nuance for AppSheet.
  • AppsterGPT should be better, but it’s instruction context window is extrmemly limited, so it’s missing a lot of nuance.
  • Appster Pro should answer questions near my level of competency.

Recently there was a really good example that came through, I thought I would share the comparison.

Original prompt:

If i have a start expression in an email template, but i only want it to show up if the related whatevers are not blank. In the start expression, how do i incorporate an ISNOTBLANK?

Core concept for the desired answer

  • You need to wrap the whole <<START: ...>> section in an <<IF: ...>> section.

Now lets see how things compare…


Vanilla ChatGPT

Okay so it needs to know we’re talking about AppSheet (fair enough I guess)

In AppSheet: If i have a start expression in an email template, but i only want it to show up if the related whatevers are not blank. In the start expression, how do i incorporate an ISNOTBLANK?

Full Response

In AppSheet, to incorporate a condition like ISNOTBLANK() in a START expression within an email template, you need to use it to filter the rows that the START expression iterates over. Here’s a step-by-step approach to achieve this:

  1. Determine the Source Table: Identify the table or slice that the START expression will iterate over.

  2. Use ISNOTBLANK in the Expression: You want to make sure the expression only includes rows where certain fields are not blank. You can achieve this by incorporating the ISNOTBLANK() function directly in the filter condition of the START expression.

  3. Modify the START Expression: Normally, a START expression looks like this:

    <<Start: [Related Whatevers]>>
    

    If you want to include only those rows where a certain column (e.g., [Column Name]) is not blank, you would modify it to:

    <<Start: FILTER("TableName", ISNOTBLANK([Column Name]))>>
    

    Here, "TableName" should be replaced with the name of the table or slice you are iterating over, and [Column Name] is the field you want to check for non-blank values.

  4. Place Your Template Code: Inside the START and END tags, place the template code that should only be displayed if the related rows are not blank. For example:

    <<Start: FILTER("TableName", ISNOTBLANK([Column Name]))>>
      [Field1] - [Field2] - [Field3]
    <<End>>
    
  5. Handling Multiple Conditions: If there are multiple columns you want to check for non-blank values, you can extend the filter expression by combining multiple ISNOTBLANK() conditions with AND():

    <<Start: FILTER("TableName", AND(ISNOTBLANK([Column1]), ISNOTBLANK([Column2])))>>
      [Field1] - [Field2] - [Field3]
    <<End>>
    

By using this approach, the START expression in your email template will only process rows where the specified fields are not blank. This allows your email template to dynamically include or exclude sections based on the presence of data in your rows, ensuring that your emails are both relevant and concise.

  • Not bad, though not exactly the nuance of what was being asked

    • In this specific scenario, they’re wanting to not show the enter <<START: ...>> section if there is nothing to show.
      • This way we don’t see the empty table. :wink:

Appster GPT

Let’s see if Appster in ChatGPT can get the answer right.

  • Nailed it!


Appster Pro

Nailed it!

  • I like this answer better than Appster GPT, it’s more concise.

And for reference: the instructions have nothing about this specifically, but it does have a bunch of stuff for how I build apps efficiently. :wink: And this is what it comes up with when you feed it that. :robot::brain::muscle:

Round 2: The Follow Up


Original Prompt:

Thank you for that. On the other hand, if i want to put a conditional in the IF, meaning, if the related whatevers > 0, then it shows the start formula, but if it is not, then i want it to show text. Can i do that in one if formula, or do i need to put another below it?

Core concept for desired answer

  • You need two separate <<IF: >> sections, one for each branch you wish to account for.

Vanilla ChatGPT

  • Not even close.

    • It’s following traditional IF/ELSE branch logic and syntax, which doesn’t apply in this situation.
Full answer

To handle this scenario in AppSheet using an IF condition within your email template, you can indeed structure it to either show the results of a START formula or display alternative text based on whether the condition (e.g., “the related whatevers > 0”) is met. You can do this all within a single IF statement. Here’s how you could structure it:

  1. Set Up the IF Condition: You will check if there are any related records and depending on the count, either execute the START expression or show alternative text.

  2. Use COUNT: To determine if “related whatevers” is greater than zero, you might use the COUNT() function on a list of related records. This function counts the number of items in a list.

  3. Construct the Email Template Expression:

    • IF with START: Here’s how to combine an IF, COUNT, and START in your template:
      <<IF(COUNT([Related Whatevers]) > 0,
          "<<Start:[Related Whatevers]>>
              [Field1] - [Field2] - [Field3]
          <<End>>",
          "No related records available."
      )>>
      

    This template checks if the number of related items is greater than zero. If true, it processes the START expression to iterate over the items; otherwise, it displays “No related records available.”

Here’s a breakdown of each part:

  • COUNT([Related Whatevers]) > 0: This evaluates whether there are more than zero related items.
  • The first part inside the IF: This is what’s displayed or processed if the condition is true. The START and END tags loop through each related item, displaying their fields as specified.
  • The second part inside the IF: This text (“No related records available.”) is shown if there are no related items.

Using this approach, you efficiently manage both displaying a list of items and handling cases where no items are present, all within a single conditional block in your template. This makes your application logic more concise and your templates easier to manage.


Appster GPT

  • Nailed it again!

    • I was rather shocked it got this, to be honest.

Appster Pro

  • And of course Appster pro is capable of this answer.

1 Like