Make Text Visible IF Statement?

  • I have a report that requires a slight modification. The user would like to output a message based on the sales order prefix.

    So.......

    IF SalesOrderID (prefix is SP) then display message "Warranty 1 year".

    ELSE IF SalesOrderID (prefix RE) then display message "Warranty 6 months".

    Should I simply have 2 text fields overlayed, then hide / unhide?

    Any advice on the correct syntax or approach much appreciated.

    Kind Regards,

    Phil.

    -------------------------------------------------------------------------------------
    A neutron walks into a bar. "I'd like a beer" he says. The bartender promptly serves up a beer. "How much will that be?" asks the neutron. "For you?" replies the bartender, "no charge."

    Two hydrogen atoms walk into a bar. One says, 'I think I've lost an electron.' The other says 'Are you sure?' The first says, 'Yes, I'm positive... '

    Tommy Cooper

  • Set the expression of the text box to:

    =IIF(Left(SalesOrderID,2)="SP","Warranty 1 Year","Warranty 6 months")

    If there are other options you may look into the Switch function.

  • Thanks for that.

    Phil.

    -------------------------------------------------------------------------------------
    A neutron walks into a bar. "I'd like a beer" he says. The bartender promptly serves up a beer. "How much will that be?" asks the neutron. "For you?" replies the bartender, "no charge."

    Two hydrogen atoms walk into a bar. One says, 'I think I've lost an electron.' The other says 'Are you sure?' The first says, 'Yes, I'm positive... '

    Tommy Cooper

  • OK, here is what I tried:

    Page Header (textbox63)

    =IIF(Left(ReportItems!RefText2.Value,3)="PUR","PURCHASE ORDER","RETURN ORDER")

    textbox63 is in the Page Header. A second textbox in the page header references a textbox in the main body:

    Page Header

    = First(ReportItems!RefText2.Value) which returns PUR0000700

    Main Body

    =": " & First(Fields!PurchaseOrderId.Value, "PurchaseOrderHeader")

    When I run the report textbox63 always returns "RETURN ORDER" even if the PurchaseOrderId = PUR

    Any Ideas,

    Thanks,

    Phil.

    Update: OK, I have now resolved. I added a different field then referenced this.

    -------------------------------------------------------------------------------------
    A neutron walks into a bar. "I'd like a beer" he says. The bartender promptly serves up a beer. "How much will that be?" asks the neutron. "For you?" replies the bartender, "no charge."

    Two hydrogen atoms walk into a bar. One says, 'I think I've lost an electron.' The other says 'Are you sure?' The first says, 'Yes, I'm positive... '

    Tommy Cooper

  • Glad you have it working. Just be aware that items in the Page Header can't reference detail records - they can only reference aggregates for the fields. Thus if you need to have a page header, you might need to use a group in a table control, and use the group header as your page header.

    Steve

    (aka smunson)

    :):):)

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • Thanks for the advice.

    Phil.

    -------------------------------------------------------------------------------------
    A neutron walks into a bar. "I'd like a beer" he says. The bartender promptly serves up a beer. "How much will that be?" asks the neutron. "For you?" replies the bartender, "no charge."

    Two hydrogen atoms walk into a bar. One says, 'I think I've lost an electron.' The other says 'Are you sure?' The first says, 'Yes, I'm positive... '

    Tommy Cooper

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply