HowTo: Invoking a Prompt from a Panel for Smart Devices

Official Content
This documentation is valid for:

Deprecated since GeneXus Evolution 2 Upgrade 3.

Please read this two links: Prompt compatibility for Smart Devices and HowTo: Create a User Prompt from scratch in Smart Devices

Many times we need to select a value in a Work With for Smart Devices List Node from a Panel for Smart Devices object or a Work With for Smart Devices.

This article explains how to call a prompt from a Panel for Smart Devices object to return a value selected from a list of data. 

In this case, the prompt will be created from a List generated by the Work With for Smart Devices object associated to a Transaction. 

To do so, follow the steps below or check this video

Step 1 – Defining the TRN and creating the List that will be used as a prompt

Create a Transaction and apply the WWSD to it. The List associated with the Transaction will be used as a prompt to select the values.

In this case, the Category Transaction is created:

Category TRN

And the WWSD is applied to generate the List:

WWSD Category

Step 2 – Creating the Panel for Smart Devices object from where the prompt is invoked

Create a Panel for Smart Devices (it can also be a Work With for Smart Devices) with the following layout:

Panel for SD

Create the following events in the Panel for Smart Devices:

Event 'Prompt'
   Composite
      WorkWithDevicesCategory.Category.List()
      SDActions.Refresh()
   EndComposite
EndEvent
Event Refresh
   &Context.FromXml(&Session.Get("category"))
   &CategoryId = &Context.CategoryId
   &CategoryName = &Context.CategoryName
EndEvent

&Context is a variable based on Context SDT, defined as fillow:

ContextSDT

With the Prompt button the Category List is invoked in order to select a value. This value will be saved in a web session, and upon returning to the Panel for Smart Devivces a refresh is performed to load this value in the Panel for Smart Devices layout.

For this to work correctly, in the WWSD the Enabled Data Caching property must be set to No.

In addition, create a Dashboard and call the Panel for Smart Devices from this Dashboard.

Step 3 – Setting the List's default action to store the selected value

Set the Default Action property of the List Grid associated with the WWSD of the Category Transaction as shown in the figure below:

Default action

Next, in the events set the Proc action as shown below:

Event 'Proc'
   Composite
      SetData(CategoryId)
      SDActions.Return()
   EndComposite
EndEvent

SetData is a procedure with the following source:

for each CategoryId
where CategoryId=&CategoryId
   &Context.CategoryId=&CategoryId
   &Context.CategoryName=CategoryName
   &Session.Set("category", &Context.ToXml())
endfor

And the following Parm rule:

parm(in:&CategoryId);

Upon selecting a value of the Category List it will allow saving it in the WebSession, so that it can later be obtained from the Panel for Smart Devices created in step 2.

At runtime, in this case from the Android emulator, call the Panel for Smart Devices object from the Menu for Smart Devices object:

execution1

Run the Prompt action to invoke the Category List:

execution2

Upon selecting a value, the Default Action (Proc) that saves the selected value in the WebSession is executed:

execution3

Upon returning to the Panel for Smart Devices, the selected value is displayed by reading it from the WebSession:

execution4

 

 



Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.