How can i Debug this crystal reports formula?

14,182

Solution 1

As CR doesn't have a debugging feature, you will need to try one of these approaches:

  • Build a formula one piece at a time and view the results on the canvas
  • Test complicated logic by returning a value for each case: If [test] Then 'A' Else If [test] Then 'B' Else 'C'
  • Refactor reusable logic into a custom function

In any case, a better way to structure the logic:

IF Not( {REPORT_INVOICE_SUMMARY.ITEMCONCAT} IN ['Move','Daywork','Billable Repair','Turnkey Daywork'] )
    AND InStr({REPORT_INVOICE_SUMMARY.ITEMCONCAT},'Non-Billable',1) = 0 THEN
    {REPORT_INVOICE_SUMMARY.QUANTITY}
ELSE
    0

Solution 2

Might be helpful if I post what I did as well.

Running Total Formaul (Basic Syntax)
dim debug as number
debug = 0

<buggy code>

formula = debug / debug   <- divide by zero  breakpoint

When run in preview you will see the variables with their current values from the formula you are trying to debug.

Share:
14,182
jordan
Author by

jordan

Updated on June 04, 2022

Comments

  • jordan
    jordan almost 2 years

    i have the following on a crystal report form as a formula:

    IF ({REPORT_INVOICE_SUMMARY.ITEMCONCAT} <> 'Move'
        and {REPORT_INVOICE_SUMMARY.ITEMCONCAT} <> 'Daywork'
        and {REPORT_INVOICE_SUMMARY.ITEMCONCAT} <> 'Billable Repair'
        and InStr({REPORT_INVOICE_SUMMARY.ITEMCONCAT},'Non-Billable',1) = 0
        and {REPORT_INVOICE_SUMMARY.ITEMCONCAT} <> 'Turnkey Daywork') then
        {REPORT_INVOICE_SUMMARY.QUANTITY}
    else
        0
    

    how can i step through it and watch what the current REPORT_INVOICE_SUMMARY.ITEMCONCAT is ?

    I really need to see the values of REPORT_INVOICE_SUMMARY.ITEMCONCAT