Google の絞り込みに次のカンマ区切りの CSV ファイルがあります。
Jython または GREL を使用して column1 の値を入力するには、次のようにします。
私が試してみました:
if value is None:
return row["record"]["cells"]["column1"]["value"][0]
else:
return value
助言がありますか?ありがとうございました
Google の絞り込みに次のカンマ区切りの CSV ファイルがあります。
Jython または GREL を使用して column1 の値を入力するには、次のようにします。
私が試してみました:
if value is None:
return row["record"]["cells"]["column1"]["value"][0]
else:
return value
助言がありますか?ありがとうございました
例のトリッキーな部分は、同じレコード内の column1 に 2 つの異なる値があるため、レコード ID 1 です。
したがって、これを完了するには、
ID
とcolumn1
フィールド
をマージして新しいインデックスを作成します(チュートリアルを参照)row.record.cells["Column1"].value[0]
を使用して記入してください (
チュートリアルを参照)プロジェクトに適用する JSON コードは次のとおりです。
[
{
"op": "core/column-addition",
"description": "Create column ID2 at index 2 based on column Column1 using expression grel:cells['ID'].value+value",
"engineConfig": {
"facets": [],
"mode": "record-based"
},
"newColumnName": "ID2",
"columnInsertIndex": 2,
"baseColumnName": "Column1",
"expression": "grel:cells['ID'].value+value",
"onError": "set-to-blank"
},
{
"op": "core/text-transform",
"description": "Text transform on cells in column ID2 using expression grel:cells['ID'].value",
"engineConfig": {
"facets": [
{
"invert": false,
"expression": "isBlank(value)",
"selectError": false,
"omitError": false,
"selectBlank": false,
"name": "ID",
"omitBlank": false,
"columnName": "ID",
"type": "list",
"selection": [
{
"v": {
"v": false,
"l": "false"
}
}
]
},
{
"invert": false,
"expression": "isBlank(value)",
"selectError": false,
"omitError": false,
"selectBlank": false,
"name": "Column1",
"omitBlank": false,
"columnName": "Column1",
"type": "list",
"selection": [
{
"v": {
"v": true,
"l": "true"
}
}
]
}
],
"mode": "row-based"
},
"columnName": "ID2",
"expression": "grel:cells['ID'].value",
"onError": "keep-original",
"repeat": false,
"repeatCount": 10
},
{
"op": "core/text-transform",
"description": "Text transform on cells in column ID2 using expression grel:cells['Column1'].value",
"engineConfig": {
"facets": [
{
"invert": true,
"expression": "value",
"selectError": false,
"omitError": false,
"selectBlank": true,
"name": "Column1",
"omitBlank": false,
"columnName": "Column1",
"type": "list",
"selection": [
{
"v": {
"v": " ",
"l": " "
}
}
]
},
{
"invert": false,
"expression": "isBlank(value)",
"selectError": false,
"omitError": false,
"selectBlank": false,
"name": "ID",
"omitBlank": false,
"columnName": "ID",
"type": "list",
"selection": [
{
"v": {
"v": true,
"l": "true"
}
}
]
}
],
"mode": "row-based"
},
"columnName": "ID2",
"expression": "grel:cells['Column1'].value",
"onError": "keep-original",
"repeat": false,
"repeatCount": 10
},
{
"op": "core/column-move",
"description": "Move column ID2 to position 0",
"columnName": "ID2",
"index": 0
},
{
"op": "core/text-transform",
"description": "Text transform on cells in column Column1 using expression grel:row.record.cells[\"Column1\"].value[0]",
"engineConfig": {
"facets": [],
"mode": "record-based"
},
"columnName": "Column1",
"expression": "grel:row.record.cells[\"Column1\"].value[0]",
"onError": "keep-original",
"repeat": false,
"repeatCount": 10
},
{
"op": "core/column-removal",
"description": "Remove column ID2",
"columnName": "ID2"
}
]