diff --git a/_posts/2019-08-29-transform.html b/_posts/2019-08-29-transform.html index 06015dbb5..b090f25a9 100644 --- a/_posts/2019-08-29-transform.html +++ b/_posts/2019-08-29-transform.html @@ -11,7 +11,7 @@

Filter

-
+
@@ -27,7 +27,7 @@

Examples:

Group By

-
+
@@ -42,7 +42,7 @@

Examples:

Mutate

-
+
@@ -60,8 +60,8 @@

Examples:

Select

-
- +
+

Description:

@@ -76,10 +76,10 @@

Examples:

Sort

-
+
-
-
+
+

Description:

Order table rows by an expression involving its variables. Use the checkbox to sort in descending order.

Arguments

@@ -93,7 +93,7 @@

Examples:

Summarize

-
+

Description:

@@ -106,7 +106,7 @@

Examples:

Ungroup

-
+
diff --git a/generators/js/transform_select.js b/generators/js/transform_select.js index 7b9f05de7..54e30d172 100644 --- a/generators/js/transform_select.js +++ b/generators/js/transform_select.js @@ -10,5 +10,5 @@ Blockly.JavaScript['transform_select'] = (block) => { .join(',') const descending = (block.getFieldValue('DESCENDING') === 'FALSE') - return `.sort(${block.tbId}, [${columns}], ${descending})` -} \ No newline at end of file + return `.select(${block.tbId}, [${columns}], ${descending})` +} diff --git a/generators/js/transform_sort.js b/generators/js/transform_sort.js index c9ed3c806..f85fe5ad8 100644 --- a/generators/js/transform_sort.js +++ b/generators/js/transform_sort.js @@ -1,16 +1,10 @@ Blockly.JavaScript['transform_sort'] = (block) => { - - -const columns = block.getFieldValue('MULTIPLE_COLUMNS') + const columns = block.getFieldValue('MULTIPLE_COLUMNS') .split(',') .map(c => c.trim()) .filter(c => (c.length > 0)) .map(c => Blockly.JavaScript.quote_(c)) .join(',') - -if (block.getFieldValue('DESCENDING') == 'FALSE') { - return `.sort(${block.tbId}, [${columns}], false)` - } else { - return `.sort(${block.tbId}, [${columns}], true)` - } + const descending = (block.getFieldValue('DESCENDING') === 'TRUE') + return `.sort(${block.tbId}, [${columns}], ${descending})` }