Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal report - Subtract result for each item

Status
Not open for further replies.

applepie4th_7

Programmer
Jun 12, 2017
7
US
Hi, I'm in the desperate need of help of experts like you guys.
On Crystal Report, I want to show My_Qty, which is {Table.1st_Qty}-{Table.2nd_qty}, for each item.

My desired outcome is

Item 1 5 0 5(My_Qty_1)
Item 2 6 0 6(My_Qty_2)

But my current CR shows

Item 1 5 0 11
Item 2 6 0 11
Is there anyway that I can adjust {Table.1st_Qty}-{Table.2nd_qty} to print out what I want?

I have tried 'Running Total Fields' but no luck.

And I've also tried the following, still not working.

WhilePrintingRecords;
{Table.1st_Qty}-{Table.2nd_qty}

I've been googling around but can't find an answer for my case. Thank you so much in advance!
 
Hi,

???

"{Table.1st_Qty}-{Table.2nd_qty}"

5-6=11???

Even us buba's in Texas know that 1) cast iron sinks, 2) pie are round and 3) 5-6 EQUALS MINUS ONE!

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Hi, SkipVought.

"{Table.1st_Qty}-{Table.2nd_qty}"
meant 5-0
or 6-0

Table.1st_Qty is 5 & Table.2nd_qty is 0.

whichever value that order is associated with.

Basically My_Qty_1 is {Table.1st_Qty}-{Table.2nd_qty}

And My_Qty_2 is {Table.1st_Qty}-{Table.2nd_qty}

The problem I'm phasing is that My_Qty_1,2,3... shows as sum of all "My_Qty"s. [(5-0)+(6-0) in this case]

Thank you for the response. I hope this would make sense. Sorry for the confusion.
Hope you stay cool in TX, here in Denver,Co is getting hotter too.
 
What are your table field names?

What is your SQL query code?

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
@Backorder is

{ORDERHDR.QTYORDER}-{ORDERHDR.QTYTOTCOMMIT}.

Please feel free to ask me any follow-up question. Thank you so much for your help
 
Can you show actual values you are getting for each item for the fields, because as Skip says the maths does not make sense. Can't see how you are getting 11

{ORDERHDR.QTYORDER}and {ORDERHDR.QTYTOTCOMMIT}

When you gave us your desired outcome
Item 1 5 0 5(My_Qty_1)
Item 2 6 0 6(My_Qty_2)

Is this from details or a summary?

Ian
 
Thanks for the reply Ian.

My actual values are the followings:

QtyOrder | Qty To Commit | My_Qty (=@BackOrder is {ORDERHDR.QTYORDER}-{ORDERHDR.QTYTOTCOMMIT} )

5 | 1 | 4
10 | 8 | 2
3 | 2 | 1


My current issue is that @Backorder shows as the sum of its values. (in this case 4+2+1 = 7)

QtyOrder | Qty To Commit | My_Qty (=@BackOrder)

5 | 1 | 7
10 | 8 | 7
3 | 2 | 7

And the fields, Qty Order, Qty To Commit, @Backorder are in 'Details'

Hope it helps and please feel free to ask me any follow-ups! Thank you so much!


 
Are you sure you have not inadvertently moved a sum Summary of @backorder into the details line.

Try deleting what you have an place the formula @backorder directly onto the detail section and do not add or perform any summaries.

Ian
 
Thank you for the quick response!

All I've been doing is creating a formula {ORDERHDR.QTYORDER}-{ORDERHDR.QTYTOTCOMMIT} under Formula Fields as BackOrder.
And place it directly to the detail section.

I don't think I know how to do a sum Summary of @backorder.. (I'm new to Crystal Report.. )

Do you think I should use WhilePrintingRecords?

WhilePrintingRecords;
{ORDERHDR.QTYORDER}-{ORDERHDR.QTYTOTCOMMIT}

it is still giving me the same output though..

Any opinion would be highly appreciated! Thank you again
 
This is a shot in the dark, but your fields are from an Order Header table. I'm wondering whether there is a corresponding table for details and whether those fields are in the detail section already, but you are then using the wrong table fields in your formula. In other words, check the table that the detail fields are referencing and make sure that's the table you are using in your formula.

-LB
 
Thank you for your response LB! I really appreciate that you took time to answer my question.

I've tried all other fields that is associated with qty, ex Qty To Pick, QtyCommit, TotQty.
But they seem to generate the same 'Sum' result.

I've loosing hope but I don't want to give up!

 
Please look at the qty field in the detail section and report back with the full name--including the table, as in {table.qty}.

-LB
 
WOW LB you are amazing!!!

I had these three in detailed section : QtyOrder | Qty To Commit | My_Qty

And For QtyOrder, It's PacklistHDR.Quantity

While for My_Qty(@backorder), I was using, {ORDERHDR.QTYORDER}-{ORDERHDR.QTYTOTCOMMIT}

As soon as I changed My_Qty(@backorder) to {PacklistHDR.Quantity}-{ORDERHDR.QTYTOTCOMMIT},
it prints out the value that I want. Not the "sum" value anymore/

You are awesome. Thank you so much for your help and time!! I've been struggling with it for quite long... I was very dumb!


[2thumbsup] you deserve more than two thumbs!! thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top