View Full Version : NavigateBegin -> NavigatePathBegin

13-Jan-2019, 12:13 AM
Hi Guys

I'm updating my customers' 253 wo's 19.0 WebApp Mobile Touch ERP, to 19.1.

I use on several occasions (23) the NavigateBegin from a Webview.
This was all fine in 19.0 but as I want to use DeepLinking in 19.1 I need to revise this.

I understand that the documentation especially in this area is still to be completed, but I'd like some feedback on my approach. It is for simplicity of this post done in WebOrderMobile.
Lets say the requirement is:
On ZoomOrder.wo we want a button that does a 'NavigateBegin' to oZoomSalesPerson.wo with the Sales person of the order selected.

I made the following changes to ZoomOrder.wo

Use ZoomSalesPerson.wo
Object oZoomOrder is a cWebView
Object oNavigateBeginToSalesPerson_btn is a cWebButton
Set piColumnSpan to 5
Set psCaption to "NavBegin to Sales person"
Set piColumnIndex to 7
Set psBackgroundColor to "green"

Procedure OnClick
RowID riSalesPerson
Get CurrentRowId of oSalesPersonDataDictionary to riSalesPerson
WebSet psSalesPerson of oNavBeginZoomSalesPerson to (SerializeRowID(riSalesPerson))
Send NavigatePathBegin oZoomSalesPerson True

In ZoomSalesPerson.wo I add the following object above the WebView

Object oNavBeginZoomSalesPerson is a cWebObject
{ WebProperty=Server }
Property String psSalesPerson

Procedure OnGetNavigateForwardData tWebNavigateData ByRef NavigateData Handle hoToView
Forward Send OnGetNavigateForwardData (&NavigateData) hoToView
WebGet psSalesPerson to NavigateData.sRowID
Move (Reftable(SalesPerson)) to NavigateData.iTable
Move nfUndefined to NavigateData.eNavigateType
WebRegisterPath ntNavigateBegin oZoomSalesPerson oNavBeginZoomSalesPerson

Please let me know if I'm on the right track. For your convenience, I've also attached the two wo's.

Kind regards

Harm Wibier
13-Jan-2019, 03:14 PM
Hi Marco,

Yes, this is how it is intended to be used. I had not thought about putting the invoking object in the view include file, but that makes perfect sense.

Note that there is a simpler alternative:

Object oWebButton1 is a cWebButton
Set piColumnSpan to 5
Set psCaption to "NavBeg to Sales"
Set piColumnIndex to 7
Set psBackgroundColor to "green"

Procedure OnClick
Send NavigateToStateHash of ghoWebApp ("SalesPerson-" + Trim(SalesPerson.ID)) False

Of course this requires a NavigateBegin path to be registered (the invoking object can be the oWebApp object):

WebRegisterPath ntNavigateBegin oZoomSalesPerson

This method only works if no additional information (not part of the url) needs to be passed. But it does make for a nice syntax, and you could even include multiple levels in the passed path, so you could even include the select view. For this to work history management needs to be enabled.

13-Jan-2019, 04:14 PM
Hi Harm

Thanks for providing that alternate way. Its interesting (and new).
But as I perhaps (for this app) will be tuning the Views psStateViewName and the DD's piPrimaryIndex I'll be careful with that for now.

I do still have an issue though.
I have a workflow that should 'clear' the back button history.
E.g. List of to be invoiced jobs <> Job invoice details entry > Job invoice Processing > Job invoice printing > List of to be invoiced jobs
Please note <> is forward navigation with Back allowed and > is where back is not allowed (history to be cleared/replaced)

I attempted this to do in the ZoomOrder with "Set pbStateReplace to True"
And get a flow like
Dashboard <> SelectOrder <> ZoomOrder > ZoomSalesPerson

But the back button history, walks all the way back and seem to not take the pbStateReplace into account.

What am I missing?

Kind regards

Harm Wibier
14-Jan-2019, 04:29 PM
Replace only replaces the current history item, it does not clear the entire history stack. There is no API for clearing the entire stack. So if pbStateReplace is true then going back should go back to the history item before the previous item...