[Question] Perspective Page Back And Forward Navigation

I have a similar navigation issue on a mobile Perspective app…upon Barcode Scan, if “A” is scanned, I need to display View A, if “B” is scanned, display View B, etc…

The barcode is setup so that it can be decoded with the first three characters…
BCAxxxxx
BCByyyyy
etc…

Since each of the barcodes decode to a (radically) different set of data…a View A would be displayed if BCA was decoded, View B would be displayed if BCB was decoded, etc…

For this to work, we would make the decision based on len( , 3), send the as a parameter to the view and open the view…not a manual selection (No Header and No Footer)…it would be automatic based on the scan.

The goal is to change the supply the parameter and load the specified view (View A, View B, etc) with a script called from the onBarcodeDataReceived() event.

Curious as to your thoughts on the dynamic load per View per Barcode type approach?

NOTE: I have a work around using containers and visibility…but it’s crazy messy (and confusing for future support)…especially with the number of different barcode types that will be in play in the system overall.

Thanks –

Let me start off with news that the back/forward navigation was implemented as part of 8.1.5.

@JHortenberry : if your View/display/structure is radically different for each type of barcode, then you really only have two choices: make a conditional check (a bunch of if statements) to determine which View to display, or incorporate the character which drives the view determination into the View path.

That is to say, I would do this:

  1. In the Barcode Scanned Event, I would use system.perspective.sendMessage() to broadcast the scanned barcode value.

  2. On the barcode scanner component I would put a Message Hander to listen for the broadcast and make a determination on which View to display (or navigate to).

  3. The script for the Message Handler would be something like

barcode = payload['barcode']
# Use the barcode character as part of the View path
# to avoid a bunch of 'if' statements
view_path = 'BarcodeTemplateViews/' + barcode[2]
# Assuming a scanned barcode value of "BCAxxxxx", this would become
# "BarcodeTemplateViews/A"
system.perspective.navigate(view=view_path, params={'barcode': barcode})
# or you can do page navigation if that makes more sense
1 Like

@cmallonee : Thanks for your comments on the approach… We were attempting to stay away from the multiple / cascade “if” approach and compartmentalize the BC logic…easier to debug / easier to support. The message handler implementing the BC logic will work.

Thanks Again!

1 Like