Results 1 to 2 of 2

Thread: Help with Crystal formula

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2005
    Posts
    43

    Help with Crystal formula

    I managed to resolve my previous thread partialy wit one small problem

    {items.qty} & ", " & {items.name} & ", "& {item.subname} & ", " & "Net kg: " & {items.mass}

    This prints

    5, Printers, HP Deskjet, Net kg: 5

    Prints OH but if a database field eg {item.subname} is empty then the line does not print

    I have tried

    if {item.subname} = "" then {item.subname} = "-"
    {items.qty} & ", " & {items.name} & ", "& {item.subname} & ", " & "Net kg: " & {items.mass}

    this however gives an error message 'The remaining text does not apear to be part of the formula'

    I then tried

    if {item.subname} = "" then {item.subname} = "-";
    {items.qty} & ", " & {items.name} & ", "& {item.subname} & ", " & "Net kg: " & {items.mass}

    with the same result the line does not print prints

  2. #2
    Addicted Member
    Join Date
    Jan 2001
    Location
    MPLS
    Posts
    187

    Re: Help with Crystal formula

    The trouble is the datafield is null and the formula does not know how to handle it. You can solve this in a couple of ways
    1) Go into File/Report Options and check Convert Database NULL Values to Default. This will affect the entire report (fields), treating null values as empty strings, but your original formula will now work for each.
    2) Instead of a formula, use a text object. Drag an empty text object onto your form, then drag each field into it and add commas in between each. The text object resolves null fields for you and treats them as empty strings.
    3) In your formula you need to use an isnull() function on fields that may result in nulls, all while appending to create one big string.

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