From 058190c0e7c61ceec33b6d666ff69cc4be056a24 Mon Sep 17 00:00:00 2001 From: Felix Lohmeier Date: Tue, 18 Aug 2020 12:07:32 +0200 Subject: [PATCH] 1100 Jahr spec_B_T_02 --- tasks/02-bibliotheca-main.sh | 137 +++++++++++++++++++++++++++++++++++ tasks/03-ba-sachsen.sh | 1 + 2 files changed, 138 insertions(+) diff --git a/tasks/02-bibliotheca-main.sh b/tasks/02-bibliotheca-main.sh index 53da0ca..85d4a17 100755 --- a/tasks/02-bibliotheca-main.sh +++ b/tasks/02-bibliotheca-main.sh @@ -740,6 +740,141 @@ else fi echo +# ----------------------------------- 1100 ----------------------------------- # + +# spec_B_T_02 +# 1100a normiert mit zahlreichen Ersetzungen +echo "Jahresangaben 1100a und 1100n..." +if curl -fs \ + --data project="${projects[$p]}" \ + --data-urlencode "operations@-" \ + "${endpoint}/command/core/apply-operations$(refine_csrf)" > /dev/null \ + << "JSON" + [ + { + "op": "core/column-addition", + "engineConfig": { + "facets": [ + { + "type": "list", + "name": "M|MEDNR", + "expression": "isBlank(value)", + "columnName": "M|MEDNR", + "invert": false, + "omitBlank": false, + "omitError": false, + "selection": [ + { + "v": { + "v": false, + "l": "false" + } + } + ], + "selectBlank": false, + "selectError": false + } + ], + "mode": "row-based" + }, + "baseColumnName": "M|JAHR", + "expression": "grel:value", + "onError": "set-to-blank", + "newColumnName": "1100n", + "columnInsertIndex": 3 + }, + { + "op": "core/column-addition", + "engineConfig": { + "facets": [ + { + "type": "list", + "name": "M|MEDNR", + "expression": "isBlank(value)", + "columnName": "M|MEDNR", + "invert": false, + "omitBlank": false, + "omitError": false, + "selection": [ + { + "v": { + "v": false, + "l": "false" + } + } + ], + "selectBlank": false, + "selectError": false + } + ], + "mode": "row-based" + }, + "baseColumnName": "M|JAHR", + "expression": "grel:with(with(with(value.replace('[','').replace(']','').replace('(','').replace(')','').replace(' ','').replace('?','').replace('.','').replace('ca','').replace('c','').replace('ff',''),x,forNonBlank(x.split('/')[1],v,v,x)),y,y.split('-')[0]),z,if(and(z.length()==4,isNumeric(z)),z,if(z=='19XX','19XX',null))))", + "onError": "set-to-blank", + "newColumnName": "1100a", + "columnInsertIndex": 3 + }, + { + "op": "core/text-transform", + "engineConfig": { + "facets": [ + { + "type": "list", + "name": "M|MEDNR", + "expression": "isBlank(value)", + "columnName": "M|MEDNR", + "invert": false, + "omitBlank": false, + "omitError": false, + "selection": [ + { + "v": { + "v": false, + "l": "false" + } + } + ], + "selectBlank": false, + "selectError": false + }, + { + "type": "list", + "name": "1100a", + "expression": "isBlank(value)", + "columnName": "1100a", + "invert": false, + "omitBlank": false, + "omitError": false, + "selection": [ + { + "v": { + "v": true, + "l": "true" + } + } + ], + "selectBlank": false, + "selectError": false + } + ], + "mode": "row-based" + }, + "columnName": "1100a", + "expression": "grel:if(cells['M|JAHR'].value.contains('19'),'19XX','20XX')", + "onError": "keep-original", + "repeat": false, + "repeatCount": 10 + } + ] +JSON +then + log "transformed ${p} (${projects[$p]})" +else + error "transform ${p} (${projects[$p]}) failed!" +fi +echo + # ================================== EXPORT ================================== # checkpoint "Export"; echo @@ -769,6 +904,8 @@ with( '2199', '0100', '0500', + '1100a', + '1100n', '1140', '2000', '4000', diff --git a/tasks/03-ba-sachsen.sh b/tasks/03-ba-sachsen.sh index 181d067..0a1da24 100755 --- a/tasks/03-ba-sachsen.sh +++ b/tasks/03-ba-sachsen.sh @@ -475,6 +475,7 @@ if(row.index - row.record.fromRowIndex == 0, '' + '\n' + forNonBlank(cells['0500'].value, v, '002@' + ' 0' + v + '\n', '') + forNonBlank(cells['0100'].value, v, '003@' + ' 0' + v + '\n', '') ++ forNonBlank(cells['1100a'].value, v, '011@' + ' a' + v + ' n' + cells['1100n'].value + '\n', '') + forNonBlank(cells['1140'].value, v, '013H@' + ' a' + v + '\n', '') + forNonBlank(cells['2000'].value, v, forEach(v.split('␟'),x,'004A' + ' 0' + x + '\n').join(''), '') + forNonBlank(cells['2199'].value, v, '006Y' + ' 0' + v + '\n', '')