Sept Head Scratcher - Help New User Moving from PhraseExpress

HI Guys
I have what i think is a complex snippet and need to know if it can be replicated in TB.
Looking at docs i am sure there must be aware but a bit beyond my skill set.
Before committing just need to know its full potential
So it looks like this in code
( 20191009 • Order tracking Version 1 with #calendar/#input - without forms*
*){#settemp -name ##ordered_on -content {#calendar -f ddddd -head Order placed on… -manual -locale en-GB}}( *
*){#settemp -name ##day_offset -content {#input -head Ordered on {#gettemp ##ordered_on} • How many delivery time in days? -def +5 -single -required}}( *

  • delivery deadline ##du_day*
    *){#settemp -name ##du_day -content {#datetime -f ddddd -value {#gettemp ##ordered_on} -s {#gettemp ##day_offset}w -locale en-GB}}( *
  • Delivery time expired?*
    *){#check -text {#datetime -a -value {#gettemp ##du_day} -locale en-GB} -case < {#datetime -a -locale en-GB} -output Hello Guys
    Please, could you get one of your Logistics Team members to chase up the shipping status for this order?
    The order was placed on {#datetime -f dddd, ddddd -value {#gettemp ##ordered_on} -locale en-GB}.

The website shows the shipping for this item is {#gettemp ##day_offset} business days.

This should have been delivered on {#datetime -f dddd, ddddd -value {#gettemp ##du_day} -locale en-GB}

The item is now {#datecalc -date2 {#gettemp ##du_day} -mode 3} business days late!
The item is now {#calc {#datetime -a -value {#gettemp ##du_day} -locale en-GB}-{#datetime -a -locale en-GB} -round 0} calendar days late!

I need this to update my customer and avoid cancellation of the order.( *

  • Delivery time not yet expired → Windows Notification*
    *) -else {#balloon -title Delivery time not yet expired: -text ##du_day: {#gettemp ##du_day} -onclick {#datetime -f ddd, ddddd -value {#gettemp ##du_day} -locale en-GB}}}

See it working see here

or view here

Hi @Thorrrr,

Here is an example that seems to cover all the commands that you might need here:

The order was placed on {formdate: DD/MM/YYYY; name=date}

shipping for this item is: {formtext: name=number; default=1} days

This should have been delivered on {time: DD/MM/YYYY; shift={=number}D; at={=date}; pattern=DD/MM/YYYY}

{today={time: X}; trim=left}

{estimated={time: X; shift={=number}D; at={=date}; pattern=DD/MM/YYYY}; trim=left}

{=round( (estimated - today) / 24 / 60 / 60)} days left

Hi Mansur
This does not accommodate business days Mon - Fri here in my country. Your cals are counting Weekends. Also is it possible to calculate the end dates

image

Here is a small adjustments to add end dates and count only business days.
The only part that might be complicated is counting how many business days a delivery is late. I will update this thread once I have a solution.

The order was placed on {formdate: DD/MM/YYYY; name=date}

shipping for this item is: {formtext: name=number; default=1} business days

This should have been delivered on {time: DD/MM/YYYY; shift={=number}D(skip=SAT, SUN); at={=date}; pattern=DD/MM/YYYY}

{today={time: X; at={time: ll}}; trim=left}

{estimated={time: X; shift={=number}D(skip=SAT, SUN); at={=date}; pattern=DD/MM/YYYY}; trim=left}

{=round( (estimated - today) / 24 / 60 / 60)} calendar days left

1 Like

Here is an updated snippet that also calculates business days left:

The order was placed on {formdate: DD/MM/YYYY; name=date}

shipping for this item is: {formtext: name=number; default=1} business days

{due={time: DD/MM/YYYY; shift={=number}D(skip=SAT, SUN); at={=date}; pattern=DD/MM/YYYY}; trim=left}

This should have been delivered on {=due}

{today={time: X; at={time: ll}}; trim=left}

{estimated={time: X; shift={=number}D(skip=SAT, SUN); at={=date}; pattern=DD/MM/YYYY}; trim=left}

{calendar=round( (estimated - today) / 24 / 60 / 60); trim=left}
{=calendar} calendar days left
{=[x for x in seq(0, calendar) if {time: DD/MM/YYYY; shift={=x}D(skip=SAT, SUN); at={time: DD/MM/YYYY}; pattern=DD/MM/YYYY}==due][1]} business days left

Hi
Is there a way to show a shortened day of week in the due formula?
E.g. Mon Tue Wed etc?

Yes, you can use different formatting options. All formatting options are here.

In this particular case ddd is what you probably want.

Here is an example:

It is currently: {time: dddd, MMMM Do, YYYY}
More briefly: {time: ddd, MMM Do, YYYY}

Yes i tried that before asking but i get an error see here

Hi @Thorrrr,

I've updated the snippet to contain shortened day of week. The trick here is to update pattern options, since we have different format now.

The order was placed on {formdate: ddd, DD/MM/YYYY; name=date}

shipping for this item is: {formtext: name=number; default=1} business days

{due={time: DD/MM/YYYY; shift={=number}D(skip=SAT, SUN); at={=date}; pattern=ddd, DD/MM/YYYY}; trim=left}

This should have been delivered on {time: ddd, DD/MM/YYYY; at={=due}; pattern=DD/MM/YYYY}

{today={time: X; at={time: ll}}; trim=left}

{estimated={time: X; shift={=number}D(skip=SAT, SUN); at={=date}; pattern=ddd, DD/MM/YYYY}; trim=left}

{calendar=round( (estimated - today) / 24 / 60 / 60); trim=left}
{=calendar} calendar days left
{=[x for x in seq(0, calendar) if {time: DD/MM/YYYY; shift={=x}D(skip=SAT, SUN); at={time: DD/MM/YYYY}; pattern=DD/MM/YYYY}==due][1]} business days left

1 Like