I'm dealing with a strange issue. I have a dropdown whose options are populated by a dataset from a dynamically generated query. This particular field is a Date type from an Oracle database. When looking at the dataset directly, the rows display as correctly formatted DateTime types (in this case the label and value should be the same):
Additionally, when the user makes a selection, the value put into the Values array is also the Unix time value. I tried to apply transforms using the binding menu on the options field, but haven't found anything that works. Apologies if this is common issue, this is my first project using Ignition and I'm unfamiliar with a large majority of the program's features. Any help resolving this would be greatly appreciated.
Browsers don't have fundamental datetime data types. So Ignition is forced to transmit timestamps in datasets or other date objects in the only loss-less format possible: the underlying UTC milliseconds.
Many Ignition components that expect datetime values automatically render them in the session timezone, and parse input in the session timezone. Other components, like the table, can be configured to recognize timestamps in specific columns.
The dropdown component doesn't have this capability. You will need to stringify the labels (not the values) for your user, applying the session time zone. This somewhat deep topic provides some tools for this:
Thanks so much for the quick response. I looked at your code from the linked post and it looks straight forward. Where would I apply this transform in Ignition? I'm assuming I don't want to run this on the dataset itself, but instead somewhere between the dataset and what's displayed in the dropdown. Where would the appropriate place be to run this "middleware"?
The linked post handles just a single timestamp. You will want to do this in a loop so you can convert all of the labels. This is commonly done in a script transform attached to the query binding. I normally prefer to move the query binding to a custom property and then use a runScript() expression binding to perform the conversion. (Using a function that does the looping in a project library script module.)