I am trying to create a button that updates a dataset and exports to a customized csv file.
Desired results:
- updates the dynamic dataset “Room_Temps” on my button.
- output to .CSV using fpmi.file.writeFile() to the desired format (shown below)
- Append a units character “°F” to the data.
- open the .csv somehow with the default app (optional)
note: the first column value is the database column name
I have a dynamic dataset on my button called “Room_Temps” that gets
properly populated by the following SQL binding:
"SELECT
t_stamp,
Room_163_Temp,
Breakdown_Room_Temp,
RTE_Freezer_EA5_Temp,
RTE_Freezer_EA6_Temp,
RTE_Cooler_EA8_Temp,
RTE_Cooler_EA7_Temp,
Frozen_Packaging_Temp,
Hog_Receiving_Temp,
Finished_Products_Temp,
Raw_Cooler_Temp,
Receiving_Dock_Temp,
Hog_Cooler_Temp,
Raw_Freezer_Temp,
Pork_Proc_Room_11_12_Temp,
Chill_Bagging_Temp_1_2,
Case_Ready_Room_Temp,
Produce_Cooler_Temp,
Pork_Proc_Room_13_14_Temp,
Chill_Bagging_Temp_3_4,
Raw_Prep_Room_Temp,
Meat_Cooler_Temp,
Raw_Packaging_Temp,
Shipping_Dock_Temp,
Shipping_Receiving_Dock2_Temp,
RTE_Cooler_2_Temp,
Costo_Production_Room_Temp,
Outside_Temperature,
FROM room_temperature_status limit 1"
Here’s how I want the data formatted - this seems to open OK in Excel if I give it a .CSV extension.
t_stamp,Tue Feb 13 12:07:48 PST 2007
Breakdown_Room_Temp,33.1 °F
RTE_Freezer_EA5_Temp,19.5 °F
Frozen_Packaging_Temp,40.2 °F
Hog_Receiving_Temp,39.2 °F
Finished_Products_Temp,37.6 °F
Raw_Cooler_Temp,31 °F
Receiving_Dock_Temp,38.7 °F
Hog_Cooler_Temp,32.8 °F
Raw_Freezer_Temp,27.8 °F
Pork_Proc_Room_11_12_Temp,41.8 °F
Chill_Bagging_Temp_1_2,45.9 °F
Case_Ready_Room_Temp,36.4 °F
RTE_Cooler_EA8_Temp,33.9 °F
Produce_Cooler_Temp,39.3 °F
Pork_Proc_Room_13_14_Temp,41.6 °F
Chill_Bagging_Temp_3_4,43.4 °F
RTE_Freezer_EA6_Temp,37.2 °F
Raw_Prep_Room_Temp,40.3 °F
Meat_Cooler_Temp,32 °F
Raw_Packaging_Temp,36.6 °F
Shipping_Dock_Temp,40.2 °F
RTE_Cooler_EA7_Temp,33.7 °F
Shipping_Receiving_Dock2_Temp,54.2 °F
RTE_Cooler_2_Temp,35.8 °F
Costo_Production_Room_Temp,41.3 °F
Outside_Temperature,63.19029 °F
Wet_Bulb_Temp,54.2019 °F