0500 spec_B_T_56

This commit is contained in:
Felix Lohmeier 2020-08-11 17:36:22 +02:00
parent a0e5225ffa
commit db4da38b52
2 changed files with 79 additions and 1 deletions

View File

@ -533,7 +533,7 @@ else
fi fi
echo echo
# --------------------------------- 12 E0XXb ---------------------------------- # # --------------------------------- 13 E0XXb ---------------------------------- #
# spec_B_E_14 # spec_B_E_14
echo "Selektionsschlüssel E0XXb..." echo "Selektionsschlüssel E0XXb..."
@ -564,11 +564,87 @@ else
fi fi
echo echo
# --------------------------------- 14 0500 ---------------------------------- #
# spec_B_T_56
# TODO: Regeln für ART=GH, ART=L
# TODO: Differenzierung nach MEDGR
echo "Gattung und Status 0500..."
read -r -d '' expression << EXPRESSION
if(
value == 'M',
'Aan',
if(
value == 'U',
'Asn',
if(
value == 'A',
'Ban',
if(
value == 'V',
'Ban',
if(
and(
value == 'P',
forNonBlank(cells['M|MEDGR'].value,v,if(v == 'SPIEL', true, false),false)
),
'Ban',
if(
value == 'P',
'Lax',
if(
value == 'G',
'Acn',
if(
value == 'S',
'AFn',
if(
value == 'Z',
'Abn',
null
)
)
)
)
)
)
)
)
)
EXPRESSION
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": [],
"mode": "row-based"
},
"baseColumnName": "M|ART",
"expression": $(echo "grel:${expression}" | ${jq} -s -R '.')
"onError": "set-to-blank",
"newColumnName": "0500",
"columnInsertIndex": 3
}
]
JSON
then
log "transformed ${p} (${projects[$p]})"
else
error "transform ${p} (${projects[$p]}) failed!"
fi
echo
# ================================== EXPORT ================================== # # ================================== EXPORT ================================== #
checkpoint "Export"; echo checkpoint "Export"; echo
# Export der PICA3-Spalten als CSV # Export der PICA3-Spalten als CSV
# Spalte 2199 muss vorne stehen, weil später für Sortierung benötigt
format="csv" format="csv"
echo "export ${p} to ${format} file using template..." echo "export ${p} to ${format} file using template..."
IFS= read -r -d '' template << "TEMPLATE" IFS= read -r -d '' template << "TEMPLATE"
@ -577,6 +653,7 @@ with(
[ [
'2199', '2199',
'0100', '0100',
'0500',
'2000', '2000',
'7100B', '7100B',
'7100f', '7100f',

View File

@ -473,6 +473,7 @@ IFS= read -r -d '' template << "TEMPLATE"
{{ {{
if(row.index - row.record.fromRowIndex == 0, if(row.index - row.record.fromRowIndex == 0,
'' + '\n' '' + '\n'
+ forNonBlank(cells['0500'].value, v, '002@' + ' 0' + v + '\n', '')
+ forNonBlank(cells['0100'].value, v, '003@' + ' 0' + v + '\n', '') + forNonBlank(cells['0100'].value, v, '003@' + ' 0' + v + '\n', '')
+ forNonBlank(cells['2000'].value, v, forEach(v.split('␟'),x,'004A' + ' 0' + x + '\n').join(''), '') + forNonBlank(cells['2000'].value, v, forEach(v.split('␟'),x,'004A' + ' 0' + x + '\n').join(''), '')
+ forNonBlank(cells['2199'].value, v, '006Y' + ' 0' + v + '\n', '') + forNonBlank(cells['2199'].value, v, '006Y' + ' 0' + v + '\n', '')