Method Community

 

Looping through table not yielding any results

Last post 10-13-2011 9:28 AM by Method_Michael. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 10-04-2011 3:56 PM

    Looping through table not yielding any results

    I am attempting to loop through the PurchaseOrderLine table and find all lines that belong to a certain Purchase Order.  My intention is in a loop to grab the ID then lookup the item and QTY, then load the results into a Sales OrderLine table.  I have confirmed with a Retrieve Value from Table that there is a result, as I have it return to me the ID in a message.  When I throw the same message into the loop after the start of the loop, nothing happens.  It appears to not yield any results, or not actually succeed in setting the action result for the line(s) found while running the loop.  This is what the action list looks like as it pertains to this issue.:


    Get Purchase Order ID from Shared result (confirmed successful)

    Start Loop through PurchaseOrderLine table based on PurchaseOrderRecordID = one grabbed from Shared Result, assign action result

    Send message to user that ID X has been grabbed for current result in loop (fails, no message appears)

    Retrieve Item & Quantity from PurchaseOrderLine table using action result  in start loop.

    Insert Record into SalesOrderLine Table using the above values and previously stored RecordID

    End Loop through Table

     

    ___

     

    What I THINK is happening is that I am not getting any results from the start of the loop.  In fact, the action result it creates that should be the ID isn't available in the drop down list for the message, I had to manually plug it in.

     

    Your assistance will be greatly appreciated.

     

  • 10-04-2011 4:40 PM In reply to

    Re: Looping through table not yielding any results

    Answer

    mlepitt-

    The Show Message action doesn't quite work when used in a loop, in a situation like this if you want to see what a loop is actually looping through I would create an action result before the start of the loop and as the loop loops append the new value to the intial action result( ActionResult = NewValue +(Join) ActionResult) and use a show message after the loop to show the ActionResult.

    I would also make sure that the SharedResult has a valid value.

    -Michael

     

    Michael Melo
    Product Manager
    Method Integration Inc.
    Website: http://www.method.me
    LinkedIn: http://www.linkedin.com/in/MichaelMelo
  • 10-05-2011 9:15 AM In reply to

    Re: Looping through table not yielding any results

    First I have confirmed the shared result is valid as I am using the same value to pull other data from the main Purchase Order record (after assigning it an action result).  Second, I am unable to do as you suggested as the action I made with the start of the loop is not available in the drop down for the Character function.  I think that is the issue, the action is not being made from the start of the loop, so nothing can be used to grab information from the table.

  • 10-05-2011 11:53 AM In reply to

    Re: Looping through table not yielding any results

    mlepitt-

    I tested it and it seems to be working fine. 

    Edit the QuickBooks_Invoice screen and take a look at the action in the Print Selected Event for the Print... button in the Existing Invoices section. It uses what I suggested to make a list of RecordID to generate a report. You can use that same concept and generate a list of other values.

    *Note Its looping through a grid instead of a table but the concept is the same.

    -Michael

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

    Re: Looping through table not yielding any results

    Michael -

     

    I have done everything I can think of and I have not been successful looping through records.  Another scenario I have tried is to make a dashboard view that tells me the sale for today.  I noticed later that you have that button/link on the default home page to do exactly that, but it has no actions atrributed to it so I can't even look at that to compare to.  Can you restore that sction that is supposed to be on the page to I can try and figure out what is going wrong?

     

    Also, I am having a tough time specifying "today" compared to a transaction date due to the various forms of formatting.  Is there is best method for this when attempting to use a loop through table function?  I hacked my way around it with a grid using hidden start and end fields with the time specified, but it seems sloppy.

  • 10-13-2011 9:28 AM In reply to

    Re: Looping through table not yielding any results

    Hi mlepitt-

    Are you taking a look at the CRM_Home Dashboard screen? The Refresh Counts button should have actions to generate these values. It also makes use of current date but there is no looping in that button.

    -Michael

    Michael Melo
    Product Manager
    Method Integration Inc.
    Website: http://www.method.me
    LinkedIn: http://www.linkedin.com/in/MichaelMelo
Page 1 of 1 (6 items)