View RSS Feed

LianjaDev

HOWTO Working with HTML Articles in Lianja 9.4

Rate this Entry
Lianja 9.4 (9.4.3) supports the ability to Create, Edit and Display HTML Articles in an ArticleView section or in the Report Viewer.

Articles are HTML formatted files that can contain {macros} and other embedded content which are substituted when displayed.

Articles are embedded in an ArticleView and are dynamically generated. They can be used in Desktop, Web and Mobile Apps.

Uses of Articles

Articles have a variety of uses including:

  • The home page or tab for your apps
  • Custom data bound presentation
  • Email and/or print letters, receipts, quotations, proposals etc from within your apps containing dynamic data e.g customer names, details, order summary etc
  • Build data-driven web sites

Here's an example ArticleView (example_datamerge App) included in the distro

Name:  Screen Shot 2023-10-11 at 5.29.49 PM.jpg
Views: 1801
Size:  108.1 KB


Creating an ArticleView

From the Form Tools choose “ArticleView” from the “Section” menu.

Creating an Article

Click the “New Article” button to create a new article or the “Edit Article” button to select an existing article to display in the ArticleView.

Editing an Article

Name:  Screen Shot 2023-10-11 at 5.30.24 PM.jpg
Views: 1857
Size:  103.4 KB


Adding dynamic content using Article Macros

You can add dynamic content to the article using {macro}.

The macro enclosed in the {..} can be any valid LianjaScriot expression.

Typically the expression will reference columns in a table that is open.

e.g

Code:
{employees.lastname}
Code:
{proper(employees.lastname)}
You can also perform more complex calculations by creating your own LianjaScript custom functions in the Apps workspace and include these with parameters in the {macro}.

These custom functions can use SQL to calculate values that will be substituted into the Article.

Note that when run in Web/Mobile these functions will have no data context as they are executed on the server. You should use PUSH/POP DATASESSION and OPEN DATABASE to ensure the correct data state.

Name:  Screen Shot 2023-10-11 at 5.36.43 PM.jpg
Views: 1806
Size:  107.5 KB


Adding dynamic content by embedding WebViewWidgets

To keep coding (No-Code and Low-Code) to a minimum there are many built-in WebViewWidgets that can used in Articles. Becoming familiar with these will speed up your development so it’s worth spending time to get to know them. You can study the code behind these to build your own custom WebViewWidgets.

Name:  Screen Shot 2023-10-11 at 5.45.00 PM.jpg
Views: 1787
Size:  109.0 KB


Adding dynamic data tables

Specify the {webview:lib:/datalistview.rsp} WebViewWidget to embed a database!table with specific columns and filter using the filter=odataexpr parameter.

Example:

Code:
{webview:lib:/datalistview.rsp?database=southwind&table=customers&columns=customerid,contactname,companyname}
Name:  Screen Shot 2023-10-11 at 5.54.04 PM.jpg
Views: 1777
Size:  118.1 KB


Adding dynamic images

Specify the {webview:lib:/imageview.rsp} WebViewWidget to embed an image from a database!table.column.

Example:

Code:
{webview:lib:/imageview.rsp?database=southwind&table=employees&column=photo&width=240px&height=240px&filter=lastname eq "{{employees.lastname}}"}
Name:  Screen Shot 2023-10-11 at 5.45.00 PM.jpg
Views: 1787
Size:  109.0 KB


Adding dynamic Charts

Specify the {webview:lib:/chartview.rsp} WebViewWidget to embed a chart into an article.

Example:

Code:
{webview:lib:/chartview.rsp?charttype=bar&caption=Vacation days&labels=Q1,Q2,Q3,Q4&data=15,10,20,6}
Name:  Screen Shot 2023-10-13 at 12.09.55 PM.jpg
Views: 1780
Size:  112.3 KB


Adding custom WebViewWidgets

You can create your own custom WebViewWidgets and embed them in an Article.

A WebViewWidget can be coded in LianjaScript (.rsp file), Python (.pysp file) or JavaScript (.jssp file).

These custom files should be created in the Apps workspace.

See the developing custom WebViewWidgets documentation.

You can embed your custom WebViewWidgets with arguments like this:

Code:
{webview:yourfilename.rsp?arg1=value&arg2=value…}
Emailing an Article

You can Email and Print articles using the Report Viewer.

Name:  Screen Shot 2023-10-14 at 11.07.08 AM.jpg
Views: 1772
Size:  93.7 KB


Printing an Article

Enable the "Print button" in the section header. Click it to print.

Name:  Screen Shot 2023-10-13 at 4.05.42 PM.jpg
Views: 1747
Size:  68.7 KB


Deploying an Article


Articles need to be deployed from the "Deploy" workspace to be accessible at runtime in Desktop, Web or Mobile.

Name:  Screen Shot 2023-10-13 at 12.18.12 PM.jpg
Views: 1784
Size:  84.6 KB

Submit "HOWTO Working with HTML Articles in Lianja 9.4" to Google Submit "HOWTO Working with HTML Articles in Lianja 9.4" to Facebook Submit "HOWTO Working with HTML Articles in Lianja 9.4" to Twitter

Updated 2023-10-16 at 03:41 by barrymavin

Tags: None Add / Edit Tags
Categories
LianjaDev , NoCode , LowCode , HOWTO

Comments

Journey into the Cloud
Join us