Fixed filter location and query nulls
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
"pluginType": "DB",
|
||||
"unpublishedAction": {
|
||||
"actionConfiguration": {
|
||||
"body": "SELECT\n i.item_number AS \"Item Number\",\n i.item_descrip1 AS \"Description\",\n CASE i.item_type\n WHEN 'P' THEN 'Purchased'\n WHEN 'M' THEN 'Manufactured'\n WHEN 'R' THEN 'Reference'\n WHEN 'T' THEN 'Tooling'\n WHEN 'O' THEN 'Outside Process'\n WHEN 'B' THEN 'Breeder'\n WHEN 'C' THEN 'Co-Product'\n WHEN 'F' THEN 'Phantom'\n ELSE i.item_type\n END AS \"Item Type\",\n CASE WHEN i.item_active THEN 'Active' ELSE 'Inactive' END AS \"Status\",\n cc.comment_user AS \"Created By\",\n COALESCE(i.item_created, cc.comment_date)::date AS \"Date Created\",\n last_txn.last_transaction_date::date AS \"Last Transaction\",\n (CURRENT_DATE - COALESCE(last_txn.last_transaction_date, i.item_created, cc.comment_date)::date) AS \"Days Unused\"\nFROM item i\nLEFT JOIN comment cc\n ON cc.comment_source_id = i.item_id\n AND cc.comment_source = 'I'\n AND cc.comment_text = 'Created'\nLEFT JOIN (\n SELECT\n isite.itemsite_item_id,\n MAX(ih.invhist_transdate) AS last_transaction_date\n FROM itemsite isite\n JOIN invhist ih ON ih.invhist_itemsite_id = isite.itemsite_id\n GROUP BY isite.itemsite_item_id\n) last_txn ON last_txn.itemsite_item_id = i.item_id\nWHERE (CURRENT_DATE - COALESCE(last_txn.last_transaction_date, i.item_created, cc.comment_date)::date)\n >= COALESCE(NULLIF('{{UnusedDays.text}}','')::int, 365)\nORDER BY \"Days Unused\" DESC",
|
||||
"body": "SELECT\n i.item_number AS \"Item Number\",\n i.item_descrip1 AS \"Description\",\n CASE i.item_type\n WHEN 'P' THEN 'Purchased'\n WHEN 'M' THEN 'Manufactured'\n WHEN 'R' THEN 'Reference'\n WHEN 'T' THEN 'Tooling'\n WHEN 'O' THEN 'Outside Process'\n WHEN 'B' THEN 'Breeder'\n WHEN 'C' THEN 'Co-Product'\n WHEN 'F' THEN 'Phantom'\n ELSE i.item_type\n END AS \"Item Type\",\n CASE WHEN i.item_active THEN 'Active' ELSE 'Inactive' END AS \"Status\",\n cc.comment_user AS \"Created By\",\n COALESCE(i.item_created, cc.comment_date)::date AS \"Date Created\",\n last_txn.last_transaction_date::date AS \"Last Transaction\",\n (CURRENT_DATE - COALESCE(last_txn.last_transaction_date, i.item_created, cc.comment_date)::date) AS \"Days Unused\"\nFROM item i\nLEFT JOIN comment cc\n ON cc.comment_source_id = i.item_id\n AND cc.comment_source = 'I'\n AND cc.comment_text = 'Created'\nLEFT JOIN (\n SELECT\n isite.itemsite_item_id,\n MAX(ih.invhist_transdate) AS last_transaction_date\n FROM itemsite isite\n JOIN invhist ih ON ih.invhist_itemsite_id = isite.itemsite_id\n GROUP BY isite.itemsite_item_id\n) last_txn ON last_txn.itemsite_item_id = i.item_id\nWHERE (CURRENT_DATE - COALESCE(last_txn.last_transaction_date, i.item_created, cc.comment_date)::date)\n >= CASE\n WHEN '{{UnusedDays.text}}' ~ '^\\d+$' THEN '{{UnusedDays.text}}'::int\n ELSE 365\n END\nORDER BY \"Days Unused\" DESC",
|
||||
"encodeParamsToggle": true,
|
||||
"paginationType": "NONE",
|
||||
"pluginSpecifiedTemplates": [
|
||||
|
||||
@@ -31,5 +31,8 @@ LEFT JOIN (
|
||||
GROUP BY isite.itemsite_item_id
|
||||
) last_txn ON last_txn.itemsite_item_id = i.item_id
|
||||
WHERE (CURRENT_DATE - COALESCE(last_txn.last_transaction_date, i.item_created, cc.comment_date)::date)
|
||||
>= COALESCE(NULLIF('{{UnusedDays.text}}','')::int, 365)
|
||||
>= CASE
|
||||
WHEN '{{UnusedDays.text}}' ~ '^\d+$' THEN '{{UnusedDays.text}}'::int
|
||||
ELSE 365
|
||||
END
|
||||
ORDER BY "Days Unused" DESC
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"isLoading": false,
|
||||
"isVisible": true,
|
||||
"key": "ui1hdgkey01",
|
||||
"leftColumn": 14,
|
||||
"leftColumn": 9,
|
||||
"maxDynamicHeight": 9000,
|
||||
"minDynamicHeight": 4,
|
||||
"minWidth": 450,
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
"mobileTopRow": 10,
|
||||
"needsErrorInfo": false,
|
||||
"originalBottomRow": 67,
|
||||
"originalTopRow": 7,
|
||||
"originalTopRow": 12,
|
||||
"parentColumnSpace": 11.265625,
|
||||
"parentId": "0",
|
||||
"parentRowSpace": 10,
|
||||
@@ -349,7 +349,7 @@
|
||||
"searchKey": "",
|
||||
"tableData": "{{unused_items.data}}",
|
||||
"textSize": "0.775rem",
|
||||
"topRow": 7,
|
||||
"topRow": 12,
|
||||
"totalRecordsCount": 0,
|
||||
"type": "TABLE_WIDGET_V2",
|
||||
"version": 2,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"animateLoading": true,
|
||||
"autoFocus": false,
|
||||
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
|
||||
"bottomRow": 7,
|
||||
"bottomRow": 12,
|
||||
"boxShadow": "none",
|
||||
"defaultText": "365",
|
||||
"dynamicBindingPathList": [
|
||||
@@ -40,9 +40,9 @@
|
||||
"renderMode": "CANVAS",
|
||||
"resetOnSubmit": false,
|
||||
"responsiveBehavior": "fill",
|
||||
"rightColumn": 14,
|
||||
"rightColumn": 18,
|
||||
"shouldAllowAutofill": false,
|
||||
"topRow": 0,
|
||||
"topRow": 5,
|
||||
"type": "INPUT_WIDGET_V2",
|
||||
"version": 2,
|
||||
"widgetId": "ui1unusddays",
|
||||
|
||||
Reference in New Issue
Block a user