CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2010
    Posts
    1

    Unhappy Partials - How to Correctly Display

    Greetings. I am creating a formula for an order report so that the items will display as whole cases and partial cases. For example, if there are 12 to the case but a customer orders 13, it displays as 12 cs and 1 p.

    Current Formula which does not work:
    totext (Truncate ({OrderDetailLot.Quantity}/{Product.AlternateUnitConversionFactor}),0)
    & "cs" & Space(3) & "/" &
    If Remainder ({OrderDetail.QtyOrdered},{Product.AlternateUnitConversionFactor})>0 then totext (Remainder({OrderDetail.QtyOrdered},{Product.AlternateUnitConversionFactor}),0)
    & "p" & Space(3)& "/" & {OrderDetailLot.LotNumber} else {OrderDetailLot.LotNumber}

    I was told to use:
    right (cstr({@your formula for qty/converstionfactor}),3)
    but have no idea how to do so as playing around with it produced no results.

    Also, the items have lot numbers. A particular shipment can come from 2 lots so it is important to have the lots show up next to the results (as you can see via the formula).

    Help!

  2. #2
    Join Date
    Jul 2005
    Posts
    1,083

    Re: Partials - How to Correctly Display

    Using Crystal Reports' syntax
    Code:
    If {Product.AlternateUnitConversionFactor}<>0 Then
       ToText({OrderDetailLot.Quantity}/Product.AlternateUnitConversionFactor},0) 
     + " cs "
     + ToText({OrderDetailLot.Quantity} - ({Product.AlternateUnitConversionFactor} * ({OrderDetailLot.Quantity}/Product.AlternateUnitConversionFactor}),0)
     + " p "
    Else
       ToText({OrderDetailLot.Quantity},0) 
     + " p "
    JG
    Last edited by jggtz; April 26th, 2010 at 11:08 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured