Fixed the error of the export button not getting all the details correctly from table.

This commit is contained in:
Salijoghli 2025-06-20 16:39:23 +04:00
parent 2a734daf74
commit 78bdb3ee82

View File

@ -599,7 +599,7 @@
"component": {
"onActionPerformed": {
"config": {
"script": "\ttry:\n\t # Get table data\n\t data \u003d self.parent.parent.parent.getChild(\"FlexContainer_0\").getChild(\"Table\").props.data\n\t\n\t # CSV header\n\t csv_content \u003d \"Event Timestamp,Duration,Name,Priority,Description,Tag\\n\"\n\t\n\t if data and len(data) \u003e 0:\n\t for row in data:\n\t val \u003d row.get(\"value\", {})\n\t row_data \u003d [\n\t str(val.get(\"EventTimestamp\", \"\")),\n\t str(val.get(\"Duration\", \"\")),\n\t str(val.get(\"Name\", \"\")),\n\t str(val.get(\"Priority\", \"\")),\n\t str(val.get(\"Description\", \"\")),\n\t str(val.get(\"Tag\", \"\"))\n\t ]\n\t\n\t # Escape commas for CSV safety\n\t row_data \u003d [field.replace(\",\", \";\") for field in row_data]\n\t csv_content +\u003d \",\".join(row_data) + \"\\n\"\n\t else:\n\t csv_content +\u003d \"No alarms in current view\\n\"\n\t\n\texcept Exception as e:\n\t system.perspective.print(\"Error during CSV export: \" + str(e))\n\t csv_content \u003d \"Error exporting alarm data\\n\"\n\t\n\t# Convert to bytes and trigger download\n\tcsv_bytes \u003d csv_content.encode(\u0027utf-8\u0027)\n\tsystem.perspective.download(\"active_alarms.csv\", csv_bytes)\n "
"script": "\ttry:\n\t # Get table data\n\t data \u003d self.parent.parent.parent.getChild(\"FlexContainer_0\").getChild(\"Table\").props.data\n\t\n\t # CSV header\n\t csv_content \u003d \"Number (ID),Event Timestamp,Duration,Priority,Description,Tag\\n\"\n\t\n\t if data and len(data) \u003e 0:\n\t for row in data:\n\t val \u003d row.get(\"value\", {})\n\t row_data \u003d [\n\t str(val.get(\"NumberID\", \"\")),\n\t str(val.get(\"EventTimestamp\", \"\")),\n\t str(val.get(\"Duration\", \"\")),\n\t str(val.get(\"Priority\", \"\")),\n\t str(val.get(\"Description\", \"\")),\n\t str(val.get(\"Tag\", \"\"))\n\t ]\n\t\n\t # Escape commas for CSV safety\n\t row_data \u003d [field.replace(\",\", \";\") for field in row_data]\n\t csv_content +\u003d \",\".join(row_data) + \"\\n\"\n\t else:\n\t csv_content +\u003d \"No alarms in current view\\n\"\n\t\n\texcept Exception as e:\n\t system.perspective.print(\"Error during CSV export: \" + str(e))\n\t csv_content \u003d \"Error exporting alarm data\\n\"\n\t\n\t# Convert to bytes and trigger download\n\tcsv_bytes \u003d csv_content.encode(\u0027utf-8\u0027)\n\tsystem.perspective.download(\"active_alarms.csv\", csv_bytes)\n "
},
"scope": "G",
"type": "script"
@ -699,7 +699,7 @@
},
"value": {
"Description": "MCM01 Hello world",
"Duration": "00:50:24",
"Duration": "01:30:31",
"EventTimestamp": "2025-06-20 15:07:03",
"Location": "MCM01",
"NumberID": 35,
@ -4614,7 +4614,6 @@
"contentStyle": {
"classes": "Background-Styles/Grey-Background"
},
"currentTabIndex": 1,
"menuType": "modern",
"style": {
"classes": "Background-Styles/Grey-Background"