Method Community

 

Shared Value not correct after some actions

Last post 12-17-2015 7:44 PM by alexhuang. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 03-18-2015 7:15 PM

    Shared Value not correct after some actions

    Hi Method,

    I encountered an issue that Method can not get correct shared result correctly.

    I have some actions in a button, here is the debug output


    Debug Tracing Why am I getting this popup? You, or another user has turned on debug tracing, which gives you a list of all actions, and their values, that are run when a button is clicked or a screen is loaded. This can be turned on or off under Customize > Display > Enable Debug Tracing.ActionInformationAssign Value To Shared ResultShared Result Name is argCLS_OKCancel was added the value CancelStart Conditional StatementWe are comparing the first value which is ServiceOrder with the second value ServiceOrder the criteria sign to evaluate the response was = result is :True Comparison type is :TextRetrieve Value From TableThe value of Retrieve First: from field: PurchaseDesc of table: viewaccItem wasAssign Value To Shared ResultShared Result Name is argNSVOL_ItemDescription was added the valueAssign Value To Shared ResultShared Result Name is argNSVOL_ItemName was added the value DEPOT FEE REVENUE:NEUTRALIZATIONAssign Value To Shared ResultShared Result Name is argNSVOL_EstimatedFinishDate was added the value Mar-25-2015Assign Value To Shared ResultShared Result Name is argNSVOL_UnitPrice was added the valueAssign Value To Shared ResultShared Result Name is argCLS_ContainerRecordIDList was added the valueAssign Value To Action ResultAction Result argCLS_ContainerRecordIDList was added the valueStart Loop Through GridQuery for Loop:SELECT ROW_NUMBER() OVER ( ORDER BY viewIEMContainer.[RecordID]) as [ROW_NUMBER], [viewIEMContainer].[RecordID], [viewIEMContainer].[TenantID], [viewIEMContainer].[ContainerNumber], [viewIEMContainer].

    , [viewIEMContainer].[CurrentReleaseNumber], [viewIEMContainer].[IsOneWayTripper], [viewIEMContainer].[owtETD], [viewIEMContainer].[owtETA], [viewIEMContainer].[owtVoyage], [viewIEMContainer].[owtDeliveryDate], [viewIEMContainer].[owtGateInDate], [viewIEMContainer].[owtCarrierCode], [viewIEMContainer].[owtOSLInvoiceNo], [viewIEMContainer].[owtPUCInvoiceNumber], [viewIEMContainer].[owtSupplier], [viewIEMContainer].[owtFreeDays], [viewIEMContainer].[owtBatchNumber], [viewIEMContainer].[FirstGateInDate], [viewIEMContainer].[owtCarrierName], [viewIEMContainer].[Price], [viewIEMContainer].[Cost], [viewIEMContainer].[owtPUC], [viewIEMContainer].[owtPerDiemRate], [viewIEMContainer].[owtRefNumberForCarrier], [viewIEMContainer].[owtTotalDays], [viewIEMContainer].[owtPayDays], [viewIEMContainer].[owtTotalPerDiem], [viewIEMContainer].[IsUnderIEMAccount], [viewIEMContainer].[LastDepot], [viewIEMContainer].[LastDepot_RecordID], [viewIEMContainer].[VendorName], [viewIEMContainer].[VendorName_RecordID], [viewIEMContainer].[LastDepotLocation], [viewIEMContainer].[AssociatedItem], [viewIEMContainer].[AssociatedItem_RecordID], [viewIEMContainer].[IEMContainerType], [viewIEMContainer].[AssociatedItemFullName], [viewIEMContainer].[AssociatedPurchaseOrderLine], [viewIEMContainer].[AssociatedPurchaseOrderLine_RecordID], [viewIEMContainer].[POLineContainerNo], [viewIEMContainer].[POLineQBItem], [viewIEMContainer].[POLineQBItemType], [viewIEMContainer].[POLineQBItemRecordID], [viewIEMContainer].[POLineLocationName], [viewIEMContainer].[POLineDepotName], [viewIEMContainer].[POLineDepotNameRecordID], [viewIEMContainer].[POLineLocationNameRecordID], [viewIEMContainer].[POLineIEMContainerType], [viewIEMContainer].[POLineVendor], [viewIEMContainer].[IEMIsOneWayTripper], [viewIEMContainer].[AssociatedPurchaseOrderNumber], [viewIEMContainer].[IEMowtBatchNumber], [viewIEMContainer].[Color], [viewIEMContainer].[Color_RecordID], [viewIEMContainer].[ConditionType], [viewIEMContainer].[ConditionType_RecordID], [viewIEMContainer].[ConditionTypeFullName], [viewIEMContainer].[AssociatedInvoiceSendReleaseHistory], [viewIEMContainer].[AssociatedInvoiceSendReleaseHistory_RecordID], [viewIEMContainer].[SendReleaseHistoryEffectiveOnDate], [viewIEMContainer].[SendReleaseHistoryExpiresOnDate], [viewIEMContainer].[owtDefaultDestination], [viewIEMContainer].[owtDefaultDestination_RecordID], [viewIEMContainer].[owtPOD], [viewIEMContainer].[owtPOD_RecordID], [viewIEMContainer].[owtDestination], [viewIEMContainer].[owtDestination_RecordID], [viewIEMContainer].[LastLocation], [viewIEMContainer].[LastLocation_RecordID], [viewIEMContainer].[owtDefaultDestinationFullName], [viewIEMContainer].[owtPODFullName], [viewIEMContainer].[owtDestinationFullName], [viewIEMContainer].[ServiceStatus], [viewIEMContainer].[ServiceStatus_RecordID], [viewIEMContainer].[IEMServiceStatus], [viewIEMContainer].[IEMServiceStatus_RecordID], [viewIEMContainer].[ServiceStatusName], [viewIEMContainer].[IEMServiceStatusDisplayName], [viewIEMContainer].[TradeStatus], [viewIEMContainer].[TradeStatus_RecordID], [viewIEMContainer].[IEMTradeStatus], [viewIEMContainer].[IEMTradeStatus_RecordID], [viewIEMContainer].[TradeStateName], [viewIEMContainer].[IEMTradeStatusDisplayName], [viewIEMContainer].[TransportationStatus], [viewIEMContainer].[TransportationStatus_RecordID], [viewIEMContainer].[IEMTransportationStatus], [viewIEMContainer].[IEMTransportationStatus_RecordID], [viewIEMContainer].[TransportationStatusName], [viewIEMContainer].[IEMTransportationStatusDisplayName] FROM viewIEMContainer WITH (nolock) WHERE viewIEMContainer.[IEMTradeStatus] IN ('Available','Reserved') AND (viewIEMContainer.TenantID=@TenantID OR viewIEMContainer.TenantID IS NULL) AND viewIEMContainer.[RecordID] IN (636) Number of records returned:1Character FunctionThe first value, which is 636, coming from VALUE FROM ROW has a character function of Join with comma on the value of coming from ACTION RESULTCharacter FunctionThe first value, which is 4 coming from ACTION RESULT has a character function of Get length on the value of coming from TYPE INStart Conditional StatementWe are comparing the first value which is 4 with the second value 4 the criteria sign to evaluate the response was > result is :True Comparison type is :NumericCharacter FunctionThe first value, which is 636 coming from ACTION RESULT has a character function of Get Left on the value of coming from ACTION RESULTAssign Value To Shared ResultShared Result Name is argCLS_ContainerRecordIDList was added the value 636Start Conditional StatementWe are comparing the first value which is 636 with the second value 636 the criteria sign to evaluate the response was = result is :False Comparison type is :TextAssign Value To Shared ResultShared Result Name is argCLS_OKCancel was added the value OK



    in this debug output, argCLS_OKCancel is a shared result, which is initialized as "Cancel" and then set as "OK". (If I put it in a action result then display it, it shows "OK", which is correct.)

    However, later, If I access this shared result in another button's actions (just get this shared result to a action result, then display it), I can not get the value "OK", but still "Cancel". 

    Can you help to show me how I can trace this kind of issue?


    Thanks.

    --

    Alex

    Chief Architect
    Yi Systems, Inc.
    alexhuang@yisystems.com
    www.yisystems.com blogs.yisystems.com
    Software.Web.Cloud.IT
  • 03-20-2015 3:24 PM In reply to

    Re: Shared Value not correct after some actions

    Hi Alex,

    Are you using the Shared Result on the same screen you're populating it from? If so, I would recommend using a hidden Textbox to hold your value instead of a Shared Result. This will allow you to make values available for different events of the same screen, but it will be a bit easier to debug since you can un-hide the Textbox while testing and see the value it contains.

    Hope this helps.

    - Justin

    Justin Henderiks
    Technical Sales Specialist
    Method Integration Inc.
    Toll Free: 1.888.925.6238
    Local and overseas: 416.847.0400
    Fax: 416.640.6027
    E-mail: j.henderiks@method.me
  • 03-24-2015 12:13 AM In reply to

    Re: Shared Value not correct after some actions

    Hi Justin,

    That shared result is updated in a pop-up screen. It is just like a popup-dialog. What I'm doing is like:

    1. in main screen, set argCLS_OKCancel = "Cancel" as a shared result.

    2. call a popup screen, if user select "OK", then argCLS_OKCancel is updated as "OK", or it is updated as "Cancel".

    3. in main screen, onClosePopup, I'll check argCLS_OKCancel.

    The problem is, if I dump argCLS_OKCancel in popupscreen, the value is correct. But once go back to onClosePopup of main screen, it seems that argCLS_OKCancel is never updated. it is always "Cancel".

    And, it seems this is a random case to me, yesterday, it worked, then it fails today, all codes are the same. any idea?

    [extra information]

    Today, I tried to test it again, and it failed (by Chrome, which I use it everyday.) Then I decide to test on FireFox, then it works perfectly. Go back to Chrome, still fails. So, I did a browse history reset (reset everything) Then Chrome works perfectly. 

    Is there anything I need to take care regarding Browser settings? Or any suggestion regarding browser version? Or, shared result is anything to browser cache or cookies?



    --

    Alex

    Chief Architect
    Yi Systems, Inc.
    alexhuang@yisystems.com
    www.yisystems.com blogs.yisystems.com
    Software.Web.Cloud.IT
  • 03-25-2015 10:19 AM In reply to

    Re: Shared Value not correct after some actions

    Answer

    Hi Alex,

    Based on what you've described, it sounds like it could be a caching issue. I'd recommend doing some further testing in incognito mode to see if the issue pops up again.

    You should also clear your Shared Results once you're done with them. Just set them to blank after you've returned from your pop-up and used the Shared Result, see if this fixes the issue.

    Hope this helps.

    - Justin

    Justin Henderiks
    Technical Sales Specialist
    Method Integration Inc.
    Toll Free: 1.888.925.6238
    Local and overseas: 416.847.0400
    Fax: 416.640.6027
    E-mail: j.henderiks@method.me
  • 03-25-2015 10:22 AM In reply to

    Re: Shared Value not correct after some actions

    Alex,

    One more thing.

    Depending on what you're trying to do, you might be able to use a Show Message action. There's an option in this action to provide a yes/no option to user, with Yes assigning True to an action result and No assigning False. Not sure if it will suit your purposes, but thought I should point it out.

    - Justin

    Justin Henderiks
    Technical Sales Specialist
    Method Integration Inc.
    Toll Free: 1.888.925.6238
    Local and overseas: 416.847.0400
    Fax: 416.640.6027
    E-mail: j.henderiks@method.me
  • 12-16-2015 11:21 PM In reply to

    Re: Shared Value not correct after some actions

    Hi Alex

    I believe your problem has to do with the shared result cookie reaching its max memory size. Once that happens, everything goes a little wonkey. Some things work, some things dont, NOTHING makes sense... you try tracking down the problem, create new problems, then all of a sudden the original problem is fixed. I struggled with this for a long time - will leave it at that for now [;)].

    If this in fact is the cause of your issues, then your solution of switching from one browser to another makes sense, since the new browser shared result cookie was presumbley not all 'used up'. 

    My current work around is to clear the cookie manually when I think I might be reaching its limit (limit varries per browser). You can do this through the developer console. In Chrome,:

    1. Open up the developer console

    2. Click on the 'Resources' tab

    3. Click on the 'Cookies' link in the side bar

    4. Under the 'Cookies' link click the 'www.methodintegration.com' link

    5. You should then see a cookie with the name 'YourAppsName.MethodActionSharedValues'

    6. You can check the size of the cookie in the column labled 'size' and delete it if need be


    I understand that this solution is not optimal/scalable/etc. What I would suggest is reworking your screen(s), replacing all shared results with hidden fields. If you need to pass a value to another screen, use the active record ID if possible. In the cases where you need to use a shared result, I would make use of XML. Each former shared result can be represented as an XML node and all the nodes can be packaged into one string using the character function action and then the resulting value can be set to one shared results value, preferably a value that can be reused on every screen (ie: Alexs_SharedResults). 

    To unpack the XML you can use the Character Function action >> Get Node Value From XML. 

    Another issue you may run into when converting from shared results to hidden fields is calling action sets within loops. Since you are not able to update a field within a loop, you will need to build your list of values (ie: table PKs) before calling the action set, set the hidden field value to your list of values, then within the action set you are calling use the 'build selection list' in the 'start loop through table' action to loop over the list of values in the hidden field.  

    Thanks


    Clayton

  • 12-17-2015 7:44 PM In reply to

    Re: Shared Value not correct after some actions

    Hi Clayton,

    Thanks for these great information. I think Method should put your post in their FAQ, that can  benefit all users. I follow Method's suggestion and see a bit improvement to my codes. However, from time to time, this kind of issues still happened. I'll try your XML idea and see how it work. 


    Thanks again!


    Alex

    Chief Architect
    Yi Systems, Inc.
    alexhuang@yisystems.com
    www.yisystems.com blogs.yisystems.com
    Software.Web.Cloud.IT
Page 1 of 1 (7 items)