Using the showdocument() function and Lianja.showDocument() method

From Lianjapedia
Jump to: navigation, search

Contents

Overview

The Lianja.getElementByID(item) method and its (quicker to type) synonym Lianja.get(item) allow you to call methods and get and set properties of the visual elements in the Lianja Object Model (LOM) hierarchy, from App through Pages and Sections to Formitems, Gadgets and Columns.

Also incredibly powerful, but possibly less well know, is the showdocument() function and the corresponding Lianja.showDocument() method.

Here are some of the operations you can do with showdocument() and Lianja.showDocument():

  • Switch to another App
  • Switch to another Page
  • Navigate records: First, Previous, Next, Last, move relative, goto record number
  • Initiate data operations: Add, Edit, Delete
  • Search and filter data
  • Refresh 'Visible when' and 'Readonly when' Rules at Section or Page level
  • Change or reset UI States
  • Navigate to the previous or next Page
  • Hide or show the left and right Sidebars
  • Hide or show the Navigation Panel
  • Expand and collapse Sections
  • Select a particular Section in an accordion Page
  • Select a particular Tab in a TabView Section
  • Dynamically change Virtual Table queries

Scripting Language Support

The showdocument() function is supported in the following scripting languages:

  • Lianja/VFP
  • JavaScript (when used on the Desktop client only).

Lianja/VFP function names are case-insensitive, but for JavaScript (case-sensitive) the function must be called as showdocument().

The Lianja.showDocument() method is supported in the following scripting languages:

  • Lianja/VFP
  • JavaScript
  • PHP
  • Python

For Python or JavaScript (case-sensitive) the method must be called as Lianja.showDocument().

Operations

app:<appid>

Switch to the specified App <appid>.

Lianja.showDocument("app:example_webapp2")
showdocument("app:example_webapp2")
  • Supported on the Desktop client only.
  • Alternatively, use Lianja.openApp(), which is supported on all clients.
Lianja.openApp("example_webapp2")

app:<appid>:<pageid>

Switch to the specified App <appid> and select the page <pageid>.

Lianja.showDocument("app:example_webapp2:employees")
showdocument("app:example_webapp2:employees")
  • Supported on the Desktop client only.

applymetadata

Applies MetaData attributes for all pages, their sections, and the fields, gadgets and columns in the sections.

Lianja.showDocument("applymetadata")
showdocument("applymetadata")

applyrules

Applies UI presentation rules for all pages, their sections, and the fields, gadgets and columns in the sections.

Lianja.showDocument("applyrules")
showdocument("applyrules")

changestate:<statelist>

Sets the UI state(s) specified in the comma-separated string <statelist>.

Lianja.showDocument("changestate:state2,state3")
showdocument("changestate:state2,state3")

resetstate

Causes all UI components to revert back to their default attributes (no UI state set).

Lianja.showDocument("resetstate")
showdocument("resetstate")

showpagesmenu

This is the same as clicking or touching the "Hamburger" Pages Menu icon. It is most useful in conjunction with gestures in mobile Apps.

Lianja.showDocument("showpagesmenu")
showdocument("showpagesmenu")
  • Supported on all clients.

back:

Navigates to the previous Page in the history.

Lianja.showDocument("back:")
showdocument("back:")
  • Note the trailing colon.
  • Supported on all clients.

forward:

Navigates to the next Page in the history.

Lianja.showDocument("forward:")
showdocument("forward:")
  • Note the trailing colon.
  • Supported on all clients.

page:<pageid>

Select the specified Page <pageid>.

Lianja.showDocument("page:employees")
showdocument("page:employees")
  • Supported on all clients.

page:<pageid>?action=<actionid>

Perform the specified Action <actionid> on the specified Page <pageid>.

The Action <actionid> can be any of the following:

applymetadata

Applies MetaData attributes for the page, its sections, and the fields, gadgets and columns in the sections.

Lianja.showDocument("page:page1?applymetadata")
showdocument("page:page1?applymetadata")

changestate:<statelist>

Sets the UI state(s) specified in the comma-separated string <statelist>.

Lianja.showDocument("page:page1?action=changestate&state=state2,state3")
showdocument("page:page1?action=changestate&state=state2,state3")

resetstate

Resets current UI states.

Lianja.showDocument("page:page1?action=resetstate")
showdocument("page:page1?action=resetstate")

show

Selects the specified page.

Lianja.showDocument("page:employees?action=show")
showdocument("page:employees?action=show")
  • Note that this is a synonym for page:<pageid>.
  • Supported on all clients.

redraw

Redraws the page.

  • Note that this includes right sidebar content gadgets.
Lianja.showDocument("page:customers?action=redraw")
showdocument("page:customers?action=redraw")
  • Supported on the Desktop client only.

print

Allows the page to be saved as an Instant Report PDF.

Lianja.showDocument("page:customers?action=print")
showdocument("page:customers?action=print")
  • Supported on the Desktop client only

hidenavigationpanel

Hides the Navigation Panel.

Lianja.showDocument("page:customers?action=hidenavigationpanel")
showdocument("page:customers?action=hidenavigationpanel")
  • Supported on the Desktop client only

shownavigationpanel

Shows the Navigation Panel.

Lianja.showDocument("page:customers?action=shownavigationpanel")
showdocument("page:customers?action=shownavigationpanel")
  • Supported on the Desktop client only.

hideleftsidebar

Hides the left Sidebar.

Lianja.showDocument("page:customers?action=hideleftsidebar")
showdocument("page:customers?action=hideleftsidebar")
  • Supported on all clients.

showleftsidebar

Shows the left Sidebar.

Lianja.showDocument("page:customers?action=showleftsidebar")
showdocument("page:customers?action=showleftsidebar")
  • Supported on all clients.

toggleleftsidebar

Toggles the left Sidebar (show/hide).

Lianja.showDocument("page:customers?action=toggleleftsidebar")
showdocument("page:customers?action=toggleleftsidebar")
  • Supported on all clients.

hiderightsidebar

Hides the right Sidebar.

Lianja.showDocument("page:customers?action=hiderightsidebar")
showdocument("page:customers?action=hiderightsidebar")
  • Supported on all clients.

showrightsidebar

Shows the right Sidebar.

Lianja.showDocument("page:customers?action=showrightsidebar")
showdocument("page:customers?action=showrightsidebar")
  • Supported on all clients.

togglerightsidebar

Toggles the right Sidebar (show/hide).

Lianja.showDocument("page:customers?action=togglerightsidebar")
showdocument("page:customers?action=togglerightsidebar")
  • Supported on all clients.

search&text=value

Searches for the specified value. Equivalent of using the Instant Search box.

Lianja.showDocument("page:customers?action=search&text=Cactus Comidas para llevar")
showdocument("page:customers?action=search&text=Cactus Comidas para llevar")
  • There must be a Search field defined on the Page.
  • Supported on all clients.

filter&text=expression

Filters the records based on the specified expression.

Lianja.showDocument("page:employees?action=filter&text=employeeid eq 3")
showdocument("page:employees?action=filter&text=employeeid eq 3")
  • Supported on all clients.
  • On the Desktop client, the eq OData Operator must be used instead of the = Lianja operator in the filter text expression.
showdocument("page:employees?action=filter&text=firstname eq 'Nancy'")
  • On the Desktop client, if the alias pointer is specified in the filter expression, -> must be used (not .).
showdocument("page:employees?action=filter&text=employees->employeeid eq 3")

not

showdocument("page:employees?action=filter&text=employees.employeeid != 3")
  • On the Web/Mobile client, OData Operators must be used in the filter text expression.
Lianja.showDocument("page:employees?action=filter&text=employeeid ge 8")

not

Lianja.showDocument("page:employees?action=filter&text=employeeid >= 8")
  • To reset the filter, use:
Lianja.showDocument("page:employees?action=filter&text=")
showdocument("page:employees?action=filter&text=")

collapse

Collapses the top section on the Page.

Lianja.showDocument("page:customers?action=collapse")
showdocument("page:customers?action=collapse")
  • Supported on the Desktop client only.
  • Alternatively, use Lianja.showDocument("page:<pageid>.<sectionid>?action=collapse") or

Lianja.showDocument("section:<sectionid>?action=collapse"), which are supported on all clients (see below).

expand

Expands the top section on the Page.

Lianja.showDocument("page:customers?action=expand")
showdocument("page:customers?action=expand")
  • Supported on the Desktop client only.
  • Alternatively, use Lianja.showDocument("page:<pageid>.<sectionid>?action=expand") or Lianja.showDocument("section:<sectionid>?action=expand"), which are supported on all clients (see below).


The following Actions correspond to the Page actionbar operations.

add

Adds a new record and displays it in edit mode.

Lianja.showDocument("page:customers?action=add")
showdocument("page:customers?action=add")
  • Supported on all clients.

delete

Prompts to delete the current record.

Lianja.showDocument("page:customers?action=delete")
showdocument("page:customers?action=delete")
  • Supported on all clients.

refresh

Refreshes the Page.

Lianja.showDocument("page:customers?action=refresh")
showdocument("page:customers?action=refresh")
  • Supported on all clients.

first

Goes to the first record.

Lianja.showDocument("page:customers?action=first")
showdocument("page:customers?action=first")
  • Supported on all clients.

previous

Goes to the previous record.

Lianja.showDocument("page:customers?action=previous")
showdocument("page:customers?action=previous")
  • Supported on all clients.

next

Goes to the next record.

Lianja.showDocument("page:customers?action=next")
showdocument("page:customers?action=next")
  • Supported on all clients.

last

Goes to the last record.

Lianja.showDocument("page:customers?action=last")
showdocument("page:customers?action=last")
  • Supported on all clients.

edit

Toggles edit mode on or off.

Lianja.showDocument("page:customers?action=edit")
showdocument("page:customers?action=edit")
  • Supported on all clients.

editmode

Goes into edit mode. Remains in edit mode if already active.

Lianja.showDocument("page:customers?action=editmode")
showdocument("page:customers?action=editmode")
  • Supported on the Desktop client only.

save

Saves changes and exits edit mode.

Lianja.showDocument("page:customers?action=save")
showdocument("page:customers?action=save")
  • Supported on all clients.

cancel

Undoes changes and exits edit mode.

Lianja.showDocument("page:customers?action=cancel")
showdocument("page:customers?action=cancel")
  • Supported on all clients.


Note that if the Page has Custom Actions defined, the Custom Action delegate will be called instead of the default operation. The 'Edit' Custom Action is called by both the edit and editmode actions.

Alternatively, use the corresponding section methods with Lianja.getElementByID(), e.g.

Lianja.getElementByID("pageid.sectionid").add()
Lianja.getElementByID("pageid.sectionid").cancel()

or its synonym:

Lianja.get("pageid.sectionid").add()
Lianja.get("pageid.sectionid").cancel()

section:<sectionid>?action=<actionid>

Performs the specified Action <actionid> on the specified Section <sectionid> in the current Page.

Note that on the Desktop client, the alternative syntax page:<pageid>.<sectionid>?action=<actionid> can be used to select the Page and perform the Action from a single command.

showdocument("page:employees.section1?action=filter&text=employeeid eq 3")
  • On the Web/Mobile client, the Page should be selected first, then the Action performed, e.g.
Lianja.showDocument("page:employees")
Lianja.showDocument("section:section1?action=filter&text=employeeid eq 3")

or

Lianja.showDocument("page:employees?action=show")
Lianja.showDocument("section:section1?action=filter&text=employeeid eq 3")


The Action <actionid> can be any of the following:

applymetadata

Applies MetaData attributes for the section and its fields, gadgets and columns.

Lianja.showDocument("section:section1?applymetadata")
showdocument("section:section1?applymetadata")

changestate:<statelist>

Sets the UI state(s) specified in the comma-separated string <statelist>.

Lianja.showDocument("section:section1?action=changestate&state=state2,state3")
showdocument("section:section1?action=changestate&state=state2,state3")

resetstate

Resets current UI states.

Lianja.showDocument("section:section1?action=resetstate")
showdocument("section:section1?action=resetstate")

hide

Hides the Section.

Lianja.showDocument("section:section1?action=hide")
showdocument("section:section1?action=hide")
  • Supported on all clients.

show

Shows the Section.

Lianja.showDocument("section:section1?action=show")
showdocument("section:section1?action=show")
  • Supported on all clients.

redraw

Redraws the Section.

Lianja.showDocument("section:section1?action=redraw")
showdocument("section:section1?action=redraw")
  • Supported on the Desktop client only.

print

Sends an Instant Report of the Section to a printer destination.

Lianja.showDocument("section:section1?action=print")
showdocument("section:section1?action=print")
  • The 'Select Printer' dialog is displayed to allow the destination to be chosen.
  • Supported on the Desktop client only

collapse

Collapses the Section.

Lianja.showDocument("section:section1?action=collapse")
showdocument("section:section1?action=collapse")
  • Supported on all clients.

expand

Expands the Section.

Lianja.showDocument("section:section1?action=expand")
showdocument("section:section1?action=expand")
  • Supported on all clients.

showsearchpanel

Shows the Section Search Panel.

Lianja.showDocument("section:section1?action=showsearchpanel")
showdocument("section:section1?action=showsearchpanel")

hidesearchpanel

Hides the Section Search Panel.

Lianja.showDocument("section:section1?action=hidesearchpanel")
showdocument("section:section1?action=hidesearchpanel")

togglesearchpanel

Toggles the Section Search Panel (show/hide).

Lianja.showDocument("section:section1?action=togglesearchpanel")
showdocument("section:section1?action=togglesearchpanel")

showquerybuilder

Shows the Query Builder in a dialog.

Lianja.showDocument("section:section1?action=showquerybuilder")
showdocument("section:section1?action=showquerybuilder")

showquerybuilderpanel

Shows the Query Builder in a slide-in dialog panel.

Lianja.showDocument("section:section1?action=showquerybuilderpanel")
showdocument("section:section1?action=showquerybuilderpanel")

The following Actions correspond to the Section actionbar operations.

add

Adds a new record and displays it in edit mode.

Lianja.showDocument("section:section1?action=add")
showdocument("section:section1?action=add")
  • Supported on the Desktop client only.
  • On the Web/Mobile client, page:<pageid>?action=add can be used on the Page's primary Section.
Lianja.showDocument("page:customers?action=add")

delete

Prompts to delete the current record.

Lianja.showDocument("section:section1?action=delete")
showdocument("section:section1?action=delete")
  • Supported on the Desktop client only.
  • On the Web/Mobile client, page:<pageid>?action=delete can be used on the Page's primary Section.
Lianja.showDocument("page:customers?action=delete")

first

Goes to the first record.

Lianja.showDocument("section:section1?action=first")
showdocument("section:section1?action=first")
  • Supported on the Desktop client only.
  • On the Web/Mobile client, page:<pageid>?action=first can be used on the Page's primary Section.
Lianja.showDocument("page:customers?action=first")

previous

Goes to the previous record.

Lianja.showDocument("section:section1?action=previous")
showdocument("section:section1?action=previous")
  • Supported on the Desktop client only.
  • On the Web/Mobile client, page:<pageid>?action=previous can be used on the Page's primary Section.
Lianja.showDocument("page:customers?action=previous")

next

Goes to the next record.

Lianja.showDocument("section:section1?action=next")
showdocument("section:section1?action=next")
  • Supported on the Desktop client only.
  • On the Web/Mobile client, page:<pageid>?action=next can be used on the Page's primary Section.
Lianja.showDocument("page:customers?action=next")

last

Goes to the last record.

Lianja.showDocument("section:section1?action=last")
showdocument("section:section1?action=last")
  • Supported on the Desktop client only.
  • On the Web/Mobile client, page:<pageid>?action=last can be used on the Page's primary Section.
Lianja.showDocument("page:customers?action=last")

refresh

Refreshes the Section.

Lianja.showDocument("section:section1?action=refresh")
showdocument("section:section1?action=refresh")
  • Supported on the Desktop client only.
  • On the Web/Mobile client, page:<pageid>?action=refresh can be used on the Page's primary Section.
Lianja.showDocument("page:customers?action=refresh")

edit

Toggles edit mode on or off.

Lianja.showDocument("section:section1?action=edit")
showdocument("section:section1?action=edit")
  • Supported on the Desktop client only.
  • On the Web/Mobile client, page:<pageid>?action=edit can be used on the Page's primary Section.
Lianja.showDocument("page:customers?action=edit")

editmode

Goes into edit mode. Remains in edit mode if already active.

Lianja.showDocument("section:section1?action=editmode")
showdocument("section:section1?action=editmode")
  • Supported on the Desktop client only.


Further Section operations:

recalc

Recalculates calculated fields in the Section.

Lianja.showDocument("section:section1?action=recalc")
showdocument("section:section1?action=recalc")
  • Supported on the Desktop client only.

move:n

Moves the record pointer by n records, either forwards (n is positive) or backwards (n is negative).

Lianja.showDocument("section:section1?action=move:2")
showdocument("section:section1?action=move:2")
Lianja.showDocument("section:section1?action=move:-2")
showdocument("section:section1?action=move:-2")
  • Supported on the Desktop client only.

goto:n

Moves the record pointer to record number n.

Lianja.showDocument("section:section1?action=goto:2")
showdocument("section:section1?action=goto:2")
  • Supported on the Desktop client only.

search&text=<expression>

Searches for the specified value.

Lianja.showDocument("section:section1?action=search&text=Ana Trujillo Emparedado")
  • There must be a Search field defined for the specified section.
  • Supported on all clients.
  • On the Desktop client, in a Page with Accordion behavior checked (True), also selects the specified Section.
  • See also Accordion Sections (Video)

filter&text=<expression>

Filters the records based on the specified expression.

Lianja.showDocument("section:section1?action=filter&text=firstname eq 'Nancy'")
showdocument("section:section1?action=filter&text=firstname eq 'Nancy'")
  • Supported on all clients.
  • On the Desktop client, the eq OData Operator must be used instead of the = Lianja operator in the filter text expression.
showdocument("section:section1?action=filter&text=firstname eq 'Nancy'")
  • On the Web/Mobile client, OData Operators must be used in the filter text expression.
Lianja.showDocument("section:section1?action=filter&text=employeeid ge 8")

not

Lianja.showDocument("section:section1?action=filter&text=employeeid >= 8")
  • To reset the filter, use:
Lianja.showDocument("section:section1?action=filter&text=")
showdocument("section:section1?action=filter&text=")

searchfilter&text=<expression>

Searches the records within the current filter based on the specified expression.

Lianja.showDocument("section:section1?action=searchfilter&text=firstname eq 'Nancy'")
showdocument("section:section1?action=searchfilter&text=firstname eq 'Nancy'")
  • Supported on all clients.
  • On the Desktop client, the eq OData Operator must be used instead of the = Lianja operator in the searchfilter text expression.
showdocument("section:section1?action=searchfilter&text=firstname eq 'Nancy'")
  • On the Web/Mobile client, OData Operators must be used in the searchfilter text expression.
Lianja.showDocument("section:section1?action=searchfilter&text=employeeid ge 8")

not

Lianja.showDocument("section:section1?action=searchfilter&text=employeeid >= 8")
  • On the Web/Mobile client, call the section refresh after searchfilter:
Lianja.showDocument("section:section1?action=refresh")
  • To reset the searchfilter, use:
Lianja.showDocument("section:section1?action=searchfilter&text=")
showdocument("section:section1?action=searchfilter&text=")

select

In a Page with Accordion behavior checked (True), selects the specified Section.

Lianja.showDocument("section:section4?action=select")
showdocument("section:section4?action=select")
  • Fully supported on Desktop client.
  • On Web/Mobile client, selects the specified Section, but does not expand the specified Section and hides other Section headers on the Page.
  • See also Accordion Sections (Video)

select&text=<tabcaption>

Applies to TabView Sections. Selects the tab with the specified tabcaption.

Lianja.showDocument("section:section1?action=select&text=Shippers")
showdocument("section:section1?action=select&text=Shippers")

select&text=<panelviewaction>

Applies to PanelView Sections. Select a panel by number according to its numeric position (n) in the Panels list:

Lianja.showDocument("page:pageid.sectionid?action=select&text=n")

Select the next panel:

Lianja.showDocument("page:pageid.sectionid?action=select&text=next")

Select the previous panel:

Lianja.showDocument("page:pageid.sectionid?action=select&text=prev")

Enable Cycle:

Lianja.showDocument("page:pageid.sectionid?action=select&text=cycle")

applyrules

Applies UI presentation rules for this sections and its fields, gadgets or columns.

Lianja.showDocument("section:section1?action=applyrules")
showdocument("section:section1?action=applyrules")


The following Actions are used with sections bound to a virtual table.

sql&text=sqlstatement

Sets the Section SQL statement attribute to the specified sqlstatement.

Lianja.showDocument("section:section1?action=sql&
text=select * from orders where customerid eq '{customers.customerid}' limit 2")
showdocument("section:section1?action=sql&
text=select * from orders where customerid eq '{customers.customerid}' limit 2")

instead of the = Lianja operator in the sqlstatement.

  • Supported on the Desktop client only.

where&text=queryexpression

Sets the Section Where condition attribute to the specified queryexpression.

Lianja.showDocument("section:section1?action=where&text=customerid eq 'WILMK'")
showdocument("section:section1?action=where&text=customerid eq 'WILMK'")
Lianja.get("pageid.sectionid").where = "customerid eq 'WILMK'"
Lianja.get("pageid.sectionid").requery()

requery&text=queryexpression

Requeries the backend data source using the specified queryexpression to replace the WHERE clause condition and any other clauses that follow it such as LIMIT or ORDER BY.

Lianja.showDocument("section:section1?action=requery&
text=customerid eq 'WILMK' limit 2 order by employeeid")
showdocument("section:section1?action=requery&
text=customerid eq 'WILMK' limit 2 order by employeeid")
  • Note that the 'WHERE' keyword itself should not be included.
  • The eq OData Operator must be used instead

of the = Lianja operator in the queryexpression.

  • In versions prior to 3.0, supported on the Desktop client only.
  • To requery removing the WHERE clause and any other clauses that follow it, use:
Lianja.showDocument("section:section1?action=requery&text=")
showdocument("section:section1?action=requery&text=")

Other Uses

Execute Command

Executes the command in the specified scripting language.

jscript:command
php:command
python:command
recital:command
vfp:command
  • Supported on the Desktop client only.

Display Document

Displays a document in the default browser or associated desktop application.

Lianja.showDocument("www.lianja.com")
showdocument("www.lianja.com")
showdocument("mytextfile.txt")
showdocument("mywordfile.docx")

To specify the local file path use:

showdocument("file:///C:\Users\MyUser\Documents\mypdf.pdf")
  • Supported on the Desktop client only.