Si ayuda con la fórmula Else
-
12-10-2019 - |
Pregunta
Quiero correr una persona si en la base de un CommandField en cada fila,
Por ejemplo
If {CommandField=0} Update counter by 1 return counter
else if {CommandField=1} return 'Reporting'
Me lo intentó pero tener errores
stringVar layerType;
shared numberVar layNo;
if({Command.ISREPORT}=0) then
layNo:=layNo+1;layerType:=layNo;layerType
else if ({Command.ISREPORT}=1) then
layerType:='Reporting'; layerType
Los resultados deberían ser como
ISREPORT LayerNo
0 1
0 2
0 3
0 4
1 'Reporter'
Solución
Not sure I understand but is this right:
stringVar layerType;
shared numberVar layNo;
if({Command.ISREPORT}=0) then
( layNo:=layNo+1;
layerType:=ToText(layNo);
layerType;
)
else
( if ({Command.ISREPORT}=1) then
layerType:='Reporting';
layerType
)
...which can be simplified to this:
shared numberVar layNo;
if({Command.ISREPORT}=0) then
(
layNo:=layNo+1;
ToText(layNo);
)
else
(if ({Command.ISREPORT}=1) then
'Reporting';)
..assuming the value of ISREPORT can only be 0 or 1 then we can further simplify to this:
shared numberVar layNo;
if({Command.ISREPORT}=0) then
(
layNo:=layNo+1;
ToText(layNo);
)
else
(
layNo:=0;
'Reporting';
)
Update - I've changed the last example to reset the counter on 'reporting'.
Edit:
change the ToText(.. to this ToText(layNo,0);
(sets decimal places to zero)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow