Display none if Calculation value = 0

Viewing 1 reply thread
  • Author
    Posts
  • July 3, 2018 at 4:11 AM #29779

    Mike Mullin
    Participant

    Hi,

    I’ve got a Completed Tasks form in which I pick Task Items (from another form) into a Table Field. Some items are quantity related, others are time related. I created a formula to calculate the final costs. The fields I’ve got are:

    Task Price (extracted from the Table)
    Quantity
    Start Time
    End Time
    Total Time (Calculation: [End Time] – [Start Time], displays 00:00 if ST en ET have no value)
    Costs ( [Task Price] * SUM( [Quantity] ; ( [Total Time] /3600))

    In case the Costs are related to a Quantity item, for layout purposes in the final Invoice form I would like to have an empty [Total Time] field if there are no values in [Start Time] end [End Time]. Is it possible to do this within the Calculation formula for [Total Time] which would state something like:
    [End Time] – [Start Time]
    display none if value [Total Time] = 00:00

    (I guess it’s not possible as there are no “styling” Functions in the list)

    If not possible, Brendan could you maybe add a checkbox to the Calculation options to be able to select something like “Display none if VALUE is 0” (or come up with a different/better solution ;-)

    Thanks

    Mike

    July 3, 2018 at 10:16 AM #29783

    Brendan
    Keymaster

    Hi Mike,

    Unfortunately at the moment that won’t work to display an empty value instead of 00:00. The reason being is that in order to return an empty value rather than a 0 value, you would need to set the Result Type to Text and return the empty string if a field value were empty. And by doing so you lose the ability to format your duration in terms of HH:MM. In Tap Forms 5.3, which I’ll have ready by the time Mojave and iOS 12 are release, will have a new Script engine in it whereby you can use JavaScript to write Calculation fields which gives you far more control over the output than the current Calculation field.

Viewing 1 reply thread

You must be logged in to reply to this topic.