cancel
Showing results for 
Search instead for 
Did you mean: 

sumar campos en crytal report

former_member930467
Discoverer
0 Kudos
852

Hola, buenos días.

Soy nuevo en este foro y necesito ayuda.

Lo que intento de hacer es un resumen de IVA por tipos.

Tengo estos tres campos en la base de datos

({CABECERAFACCOMPRAS.BASE1})

{CABECERAFACCOMPRAS.TIPOIVA1}

{CABECERAFACCOMPRAS.IVA1}

y esta formula en el repport

{@TIVA1}

en la formula le doy valor del tipo de IVA que quiero buscar, Ejemplo (21,00)

Creo un campo de total acumulado en el cual indico que me sume el campo ({CABECERAFACCOMPRAS.BASE1})

y en evaluar pongo esta formula

if {CABECERAFACCOMPRAS.TIPOIVA1}={@TIVA1} then Sum ({CABECERAFACCOMPRAS.BASE1})

pero no suma nada

Alguien me podria decir como hacerlo ?

former_member30
Community Manager
Community Manager
0 Kudos

Hi and welcome to the SAP Community!

Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers (if you haven't already), as it provides tips for preparing questions that draw responses from our members.

Should you wish, you can revise your question by selecting Actions, then Edit (although once someone answers your question, you'll lose the ability to edit the question -- but if that happens, you can leave more details in a comment).

Finally, if you're hoping to connect with readers, please consider adding a picture to your profile. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS. By personalizing your profile with a photo of you, you encourage readers to respond.

Cheers,

Julia
SAP Community Moderator

Accepted Solutions (0)

Answers (1)

Answers (1)

DellSC
Active Contributor
0 Kudos

The "Evaluating" part of a Running Total tells Crystal when to do the summary and needs to evaluate to either True or False. Try changing the formula to this:

{HEADERFACCOMPRAS.TIPOIVA1-lex.europa.eu = {@TIVA1}

-Dell

former_member930467
Discoverer
0 Kudos

Okay, thank you very much. This works for me

{CABECERAFACCOMPRAS.TIPOIVA1}={@TIVA1}

But I have another ploblema, when one of the fields {CABECERAFACCOMPRAS.TIPOIVA1} is null does not add anything to me.

How can I fix it?

Thank you very much for your help

DellSC
Active Contributor
0 Kudos

How are you using the field? If it's in a formula, please post the full formula.

Thanks!

-Dell

former_member930467
Discoverer
0 Kudos

if isNull({#BASE51}) then +0 else +{#BASE51}+

if isNull({#BASE52}) then +0 else +{#BASE52}+

if isNull({#BASE53}) then +0 else +{#BASE53}

DellSC
Active Contributor
0 Kudos

You can't chain If statements together like this - Crystal can't process them correctly. Instead, I would do something like this:

NumberVar result := 0;
if not isNull({#BASE51}) result := {#BASE51};
if not isNull({#BASE52}) then result := result + {#BASE52};
if not isNull({#BASE53}) then result := result + {#BASE53};
result

However, it looks like you're using running totals in this formula, which may cause an issue when you try to use this in the Evaluate portion of another running total. You might need to add the following to the top of the formula:

EvaluateAfter({#BASE51});
EvaluateAfter({#BASE52});
EvaluateAfter({#BASE53});

This will ensure that the running totals have been calculated prior to getting the value of this formula.

-Dell

former_member930467
Discoverer

Muchas gracias por tu ayuda.

esta solucionado con esto que me dices

NumberVar result:=0;ifnot isNull({#BASE51})result:={#BASE51};ifnot isNull({#BASE52})thenresult:=result+{#BASE52};ifnot isNull({#BASE53})thenresult:=result+{#BASE53};result