Method Community

 

SQL override in custom grid. Combine two fields into one

Last post 10-12-2015 7:26 AM by jsenick. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-09-2015 5:19 PM

    • l.brandow
    • Top 25 Contributor
    • Joined on 03-18-2011
    • American Fork, Utah
    • Posts 243

    SQL override in custom grid. Combine two fields into one

    How to create a very simple SQL override in a custom grid.

    My grid is based off the customer table

    I thought I could look at the current examples on the standard screens as a guide. This is what I tried at first:


    (CASE WHEN viewCustomer.Contact IS NULL OR viewCustomer.Contact=''
    THEN ''
    ELSE + viewCustomer.Contact END)

    + (CASE WHEN viewCustomer.Email IS NULL OR viewCustomer.Email=''
    THEN ''
    ELSE '<br /><a href=''mailto:' + viewCustomer.Email + '''  target=''new''>' + viewCustomer.Email + '</a>' END)

    I tried using Entity instead of Customer. I tried including an + symbol at the beginning.

    None of those things worked.

    I tried going really simple with this:

    SELECT contact FROM customer.

    That gave me an error saying the customer table didn't exist. (huh?)

    I tried this:

    contact + email

    ...and it worked!

    So I dumbed my original effort down to this and got what I wanted:

    (CASE WHEN Contact IS NULL OR Contact=''
    THEN ''
    ELSE + Contact END)

    + (CASE WHEN Email IS NULL OR Email=''
    THEN ''
    ELSE '<br /><a href=''mailto:' + Email + '''  target=''new''>' + Email + '</a>' END)

    The problem is there is no way to trouble shoot. I had no idea what I was doing wrong. The only feedback I got was a message where the grid results are suppose to be after I publish the screen. It just says, "Error Generating Grid..." or go refresh the customer table to re-create it.


    I hope this helps somebody because it sure was taxing to figure it out. I can't believe I couldn't find a post on this anywhere.

    Lance Brandow
    Method Customization Expert
    Brandow Consulting
    (801) 687-3254
  • 10-12-2015 7:26 AM In reply to

    • jsenick
    • Top 150 Contributor
    • Joined on 03-29-2013
    • Jamestown, NY USA
    • Posts 35

    Re: SQL override in custom grid. Combine two fields into one

    You could also try using viewaccCustomer.fieldName or viewaccEntity.fieldName when referencing QuickBooks specific tables.

    Reference forum post: https://www.method.me/cs/forums/t/5538.aspx

    James

    James Senick
    JamestownStamp.com
Page 1 of 1 (2 items)