Method Community

 

Easy Way to Check If Grid Has Records

Last post 12-22-2011 10:42 AM by Blake C. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 12-21-2011 4:23 PM

    Easy Way to Check If Grid Has Records

    Sorry for the n00b question...but am I missing something? What's the easiest way to see if a grid has any records?

    Thx 

    Blake C
  • 12-21-2011 5:00 PM In reply to

    Re: Easy Way to Check If Grid Has Records

    Blake-

    If you look at the grid and you don't see any rows then it is empty (Unless the data is filtered) Stick out tongue.

    You could also export the table the grid is based off using the Import / Export tool found under Customize > Intergration Tools, this exports the raw unfiltered data from the table

    Why are wanting to see if a grid is empty? Maybe we can provide other suggestion as well.

    -Michael 

     

    Michael Melo
    Product Manager
    Method Integration Inc.
    Website: http://www.method.me
    LinkedIn: http://www.linkedin.com/in/MichaelMelo
  • 12-21-2011 5:06 PM In reply to

    Re: Easy Way to Check If Grid Has Records

    Blake,

    You are also able to see a record count in the grey area at the bottom of the grid. Geeked

  • 12-21-2011 5:12 PM In reply to

    Re: Easy Way to Check If Grid Has Records

    Sorry. Should have given more context.

    I'm deleting a current, active record (linked to a customer). There's a grid on the left showing other records for the current customer. If the deleted record represents the final record for that customer, I want to close the page and go elsewhere.

    If there are still other records for that customer, I want to set the active record for that page to the first row in that grid.

    I'm trying to create the necessary actions to do this. Easily determining if there are records in a grid would be nice and easier than what I'm trying to do now...which is get a value from screen (CustomerID) and query a table looking for results, then going from there.

    Hope that makes sense...Thx

    Blake C
  • 12-21-2011 10:08 PM In reply to

    Re: Easy Way to Check If Grid Has Records

    Answer

    Update: I got it working. It ain't pretty, though.

    Adding to my description in my previous post...

    After deleting the active record, I wound up basically reloading the page. This page is passed a custom filter for the grid on the left, so I had to grab a couple items from the screen BEFORE deleting the active record, setting these items as Shared Results to pass to the page, and then 'reload' the page by showing the current Tab link again ensuring the view is filtered properly.

    If the deleted active record is the last record for the customer, I detect that by querying the table and finding no results. In that case, I close the current Tab link and to go to another Tab link.

    Here's a link to the screenshot of my actions - http://bit.ly/vOof2D

    Blake C
  • 12-22-2011 6:24 AM In reply to

    Re: Easy Way to Check If Grid Has Records

    Blake C

    You might try using Retreive Value From Table (select RecordID as the field)

    Use the same where clause as the grid filter and instead of retreiving first get the count of records.

    If the count is equal to zero then there are no records.

    Mark Crews
    Cloud Consultancy
    Principal and Developer


    • 2012 MethodCRM Partner of the Year

    • 2012 MethodCRM Community Excellence Award

    • 2011 MethodCRM Community Excellence Award


    Visit our website to find out about our training, support, and customization services.
    website: cloudconsultancyllc.com
    blog: cloudconsultancyllc.com/blog/
    ph: 434.326.1601
    e: support@cloudconsultancyllc.com

    What is Method?
  • 12-22-2011 6:35 AM In reply to

    Re: Easy Way to Check If Grid Has Records

    Could you just use a GetSum action that gets the sum of the RecordIDs in the grid?

    If the sum is greater than 0 there are records, otherwise there are no records.

    I haven't tried it, but I don't see why it wouldn't work.

    Paul

  • 12-22-2011 10:37 AM In reply to

    Re: Easy Way to Check If Grid Has Records

    @LaCrews

    Yeah, that's what I wound up doing. This solution made more sense once I decided to just effectively load the tab again rather than mess with looking at a grid. Take a look at the link I posted to see the actions I wound up using.

    Thx

    Blake C
  • 12-22-2011 10:42 AM In reply to

    Re: Easy Way to Check If Grid Has Records

    @Method_Paul

    At first I was doing that (do a SUM for records in the grid), but then I was faced with trying to manually select the first row in that grid so I just decided to load the tab again knowing this would be the easiest.

    In the end, it was the easiest. Check the link in my post to see the actions I wound up using to get it done.

    Thx

    Blake C
Page 1 of 1 (9 items)