Method Community

 

Harmonizing parent and subaccount address fields

Last post 03-31-2014 9:31 AM by Method_Adam. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 03-26-2014 2:26 PM

    Harmonizing parent and subaccount address fields

    I'm trying to enure all jobs (ie. subaccounts) have the same addresses as their parents and I thought a quick custom screen with a button should do it. But I'm having issues in getting it to work.

    Let's deal with the BillAddressPostalCode field as an example. I'd like to:

    • Loop through the Customer table (or grid)
      • The table loop (or grid) filter criteria are:
        • IsActive = YES
        • ParentFullName is not blank
    • Update the BillAddressPostalCode field with the BillAddressPostalCode value in the Customer table WHERE the ParentFullName of the row in question equals the FullName found in the Customer table. In this way, we are looping through the table and for each row (IsActive = yes and ParentFullName is not blank), I'm trying to populae that row's postal code with the postal code of its parent.
    I've tried it with a grid and looping through a grid, updating the fields in the grid - it's really just 1 line of coding in addition to the 2 loop through grid actions. But that didn't update anything. Is it better to loop through the table instead and update the field in the table. If so, how?

    Thanks
  • 03-28-2014 9:33 AM In reply to

    Re: Harmonizing parent and subaccount address fields

    Hi Mike,

    I believe you might be missing a "Retrieve value from table" action.  In the "Update field in Table" action, there are 5 ways to find the new value: Type In, Action Result, Value from Row, Value from Screen and Value from Session.  Type In, Value from Screen and Value from Session we know won't work.  That leaves Action Result and Value from Row. My hunch is that you're using Value from Row, which also won't work. The reason is that the row is the grid row that is filtered to only show Customers with ParentFullNames. These are your subaccounts and they don't hold the postal code you wish to use.

    If you use the "Retrieve value from Table" first, you will be able to locate the proper record in the table then use that action result to populate the grid row. See below for an example.

    Hope this helps,

    - Adam

    Adam Lyons
    Manager of Support
    Method Integration
    a.lyons@method.me
  • 03-28-2014 9:54 AM In reply to

    Re: Harmonizing parent and subaccount address fields

    "My hunch is that you're using Value from Row, which also won't work."

    Correctamundo.

    Thanks for your help!

  • 03-28-2014 10:09 AM In reply to

    Re: Harmonizing parent and subaccount address fields

    Wait a second, though.

    Do I need to loop through a grid and retrieve from the Customer table? If so, should the grid be of unique ParentFullnames (ie. parent accounts only) to maximize efficiancy?

    Would the logic then be:

    1. Loop throught the grid of FullNames, with the grid filtered for parents only (ie. ParentFullName is blank)
    2. Retrieve the postal code in the customer table where the FullName in the grid equals the FullName in the customer table. Enter into action result "Postal"
    3. Update ALL records in the customer table where the FullName in the grid equals the ParentFullName in the customer table. Does the looping address this part?
    Or do I need the grid to be populated with non-parent accounts (ie. ParentFullName is NOT blank), and then loop through the (non-unique) ParentFullName fields for each row in that grid?
    Please clarify.
    Thanks
  • 03-31-2014 9:31 AM In reply to

    Re: Harmonizing parent and subaccount address fields

    Hi Mike,

    I suggest using a grid so that you can see the results of the update.  Either way you filter the grid, you'll be looping though the Customer table, because that's where you'll want to change the values.

    If you wish to filter the grid to show only parents, then you could do that.  This will actually only take one action then, which is simply to update the field in the table.  This would actually be more efficient. Perhaps then just include a gird view to show the sub-accounts afterwards to see the changes.  Here is what the single update action would look like:

    - Adam

     

    Adam Lyons
    Manager of Support
    Method Integration
    a.lyons@method.me
Page 1 of 1 (5 items)