Adding Timestamp to Specific Field

Good Morning!
I am creating an app relating to logistics. The function that I am trying to build is when a button is pressed, it sets the vehicle to the ‘Next Status’ (such as ‘en-route’ or ‘arrived’) and logs the current time. This then steps through all status. I currently have the ‘Statuses’ sorted by creating an Option Set with a ‘Next Status’ attribute so the next Status is always known. However I am unable to work out how to insert the current time into the specific database field (see below) that is related to the status.

Thanks in Advance!

I’m not exactly sure what you’re asking here…

But the current time is accessed with the ‘Current Date/Time’ data source.

Good Morning! Apologies - Ill try and rephrase using a different example that may answer the question in my head.

I would like to insert data into a specific field on a thing, however the function needs to be dynamic as the previous step would inform which field needs filling. I am trying to work out how this would work? :slight_smile:

Thanks, AJ :slight_smile:

Yes… there are a couple of ways to do it…

First you can use conditional workflow actions in your workflow…

i.e. if you have 5 fields, then use 5 actions… one for each field, which run conditionally based on which option from the dropdown has been selected.

Secondly, you can use the data API instead, where you can define the field to modify dynamically (directly from the dropdown’s value).

In either case, using an option set for the dropdown options would be best.

1 Like

Also your Status times are texts. They ought to be dates.

1 Like

Thank you folks, I will go and have a look at these now. Was trying to avoid conditional workflows if possible to minimise data processing. @georgecollier I was aiming to minimise front-end processing as I only need times as 00:00 and thought re-formatting times front-end from dates to time may hinder processing… am I looking at this incorrectly do you think?

A :slight_smile:

Yes, you shouldn’t consider that as a factor.

The second you convert a date to text, you can’t do anything with it. In Bubble, you have no way (well technically you can really inefficiently) of working out when that date is so it is virtually useless. If you wanted to display the shipment progress on a timeline for example, you basically can’t do this if you have the times saved as text. In addition, you can’t account for timezones if saved as text.

Save each status update time as Current date:time. Don’t round it at all. Then, if you want to display it on a page, use :formatted as date and format as dd/mm/yyyy or something which will only show the date rather than the time. Equally, if you want to display the time just use hh:mm.

1 Like

Thank you @adamhholmes. I am not aware how to define the field to modify dynamically… and cannot find any literature on it. Have you got any time to expand at all?

Many thanks. A

If drop-down value is P, action to modify field Q. If drop-down value is Y, action to modify field X. In this case, you have two Make changes to a Thing actions which both have Only when Dropdown’s value is P in the first case or Y in the second case.

If I was building this app I’d have a data type ‘Status Update’ which contains the Shipment, date, and Status. Then, on the shipment I’d have a list of Status Updates which contain info about what status was updated to and when.

In many cases, if you need to dynamically specify fields, you actually just need a new data type and will find that easier to work with and build on in future.

1 Like

Thank you @georgecollier and @adamhholmes for your support, I raise my coffee cup to you! Got exactly what I need and in a new approach that you have taught me.

Many thanks!!
A :grinning:

You just define the field in a body parameter of the API call.

The Data API - Bubble Docs

Data API requests - Bubble Docs

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.