Recent

Author Topic: Ocultar valores en cero con LastReport  (Read 3966 times)

esdonis

  • Jr. Member
  • **
  • Posts: 61
Ocultar valores en cero con LastReport
« on: January 22, 2018, 05:29:35 pm »
Estoy tratando de cultar los valores en cero de una formula.

Pero me oculta los valores si una parte de la expresion = 0 no el valor total

La formula es la que sigue:

[[datmod.tsqlquery."EXIST"]-[datmod.tsqlquery."CANTIDAD"]]

si por ejemplo es valor es:
[[20]-[0]]
Me oculta el valor sin embargo el resultado es 20 no 0

Como podria solucionar este problema?

GAN

  • Sr. Member
  • ****
  • Posts: 370
Re: Ocultar valores en cero con LastReport
« Reply #1 on: January 22, 2018, 11:08:45 pm »
Con código, te muestro un ejemplo.

En tu caso podría ser algo así:

Code: Pascal  [Select][+][-]
  1. if ([datmod.tsqlquery."EXIST"]-[datmod.tsqlquery."CANTIDAD"]) <=0 then text:='';
  2.  

Y en texto:

Code: Pascal  [Select][+][-]
  1. [[datmod.tsqlquery."EXIST"]-[datmod.tsqlquery."CANTIDAD"]]
  2.  
Lazarus 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

esdonis

  • Jr. Member
  • **
  • Posts: 61
[Resuelto] Ocultar valores en cero con LastReport
« Reply #2 on: January 23, 2018, 01:34:10 pm »
Perfecto

Muchas Gracias por la ayuda

esdonis

  • Jr. Member
  • **
  • Posts: 61
Re: Ocultar valores en cero con LastReport
« Reply #3 on: January 23, 2018, 05:57:19 pm »
La solución final fue poner en el código:

if ([datmod.tsqlquery."EXIST"]-[datmod.tsqlquery."CANTIDAD"]) = 0 then
 text:=''
else
 text:=[datmod.tsqlquery."EXIST"]-[datmod.tsqlquery."CANTIDAD"];

Porque si no pongo el else al encontrar el primer valor = 0 sigue asumiendo el resto de los valores como cero

 

TinyPortal © 2005-2018