/
Models

Models

  • Models are used to display content in the layout

  • Typically used for record creation or editing, as well as various types of messaging

  • A Model needs to be added when you perform any action in an event

  • There are 2 types of Model

    • Single Record Model:

      • The single record Model is generally used when only a single record needs to be displayed at a time

      • e.g. Single record Model is used in the Form component

    • Multi record Model:

      • The multi-record Model is used when multiple records need to be displayed at a time

      • e.g. Multi record Model is used in the Table component

Model Creation

  • Create a Multirecord model

    • Go to the Model tab in the layout designer

    • Click on the + icon

    • Enter information, click Save

Model Creation
  • Click Details tab

    Detail Tab
  1. Label: The label is used to identify the Model at the UI

  2. Name: Name is the unique identifier of the Model

  3. Type: Display the Model's type

    1. There are five types that are Record, API, Aggregate, and Item

    2. Select the type from the dropdown menu

  4. Record Count: Record count indicate which record should be created

    1. There are two types of records, Single record, and Multirecord

    2. Select the record count from the dropdown menu

  5. Is Shared?:

  6. Object Def: You can bind the object with the model

    1. The complete list of objects in your instance is displayed

    2. Select the object from the dropdown menu

  7. Offset: You can set the offset for the query on the object. If the offset is “n“ then the query will take the records “n+1” onwards

    1. e.g. Set Offset: 0, then the query will take the record 1 onwards

  8. Limit: Set the limit for how many records you want to display at a time

  9. Order By: You can set the order by on the fields to records to be queried and displayed in the Model

    1. Click on the + icon

    2. Fill in the information, click Save

 

  1. Field name: All field names will display which is present in the object

    1. Select the field name from the dropdown menu

  2. Sort As: Arranging the data in a particular format

    1. There are two types of sorting

      1. Ascending: Elements are arranged from lowest to the highest value

      2. Descending: Elements are arranged from highest to the lowest value

    2. Select the option from the dropdown menu

  • Click Fields tab

    • Select the field. These fields are added to the selected fields

    • These selected fields are added to the model

  • Click the UI Fields tab

    • Click New button

      • Enter information, click Save

        1. Label: Label for the fields

        2. Name: Name is a unique identifier for the field

        3. Merge text: You can merge messages by using their source type

  • Click on the Config icon

    • Enter information, click Save

  1. Field Source:

    1. Select the field source from the dropdown menu

      1. Field: The object that adds to the model, those fields are displayed in the field attribute

        1. Select the fields from the dropdown menu

      2. Variable: Variables are containers for storing data values in PWR Apps

        1. There are different types of variables such as Integer, Double, Date, Time, etc.

        2. Select the variable from the dropdown menu

      3. Model: The model you created will be displayed

        1. Select the model from the dropdown menu

      4. Static: You can enter any (hardcoded) value

        1. e.g. Static: Test

      5. Cookie: A cookie is a piece of data, that is stored within a web browser

        1. If you have stored some value in cookies like SID, so you can get it from cookies

          1. e.g. Cookie: Name - Record, Value - 12345

      6. LocalStorage: Local storage is a piece of data, that is stored within a web browser

        1. If you have stored some value in local storage like data, so you can get it from storage

          1. e. g. LocalStorage: Key - isAdmin, Value - true

      7. QueryParam: Query parameters are a defined set of parameters attached to the end of a URL

        1. e.g. QueryParam: www.test.com?Name

      8. User: The fields that are present in a user's profile that will be displayed

        1. Select the field from the dropdown menu such as First Name, Last Name, Name, Phone, Email, Is Active, Id, Session Id

  2. Static Value:

  3. Merge Field Expression: A field is formed during the expression and many expressions are created by using a merge field

    1. An expression is added to the message body by clicking the + icon

  4. Message Body: In the merge, field expression will be displayed in the message body

  • Click the Criteria tab

  • Click on the Filter + icon

    • Filter: Filter criteria allow you to compare records from one object to records from another

    • Enter information, click Save

  1. Field Name: Names of fields that are present in the object

    1. You can add criteria to that field

    2. Select the field name from the dropdown menu

  2. Operator: The operator is a character that represents a specific mathematical or logical action

    1. Select the operator from the dropdown menu

      1. Equals: Used to compare two values

      2. NotEquals: Checks whether two values are not equal

      3. Start with: Checks any string that starts with

      4. Contains: Indicates a search for any of the specified words within a particular attribute

      5. EndsWith: String ends with the specified value

      6. In: Allows you to easily test if an expression matches any value in a list of values

  3. Source Type:

    1. Select the source type from the dropdown menu

    2. Such as Field, Variable, Model, Static, Cookie, LocalStorage, QueryParam, User

  4. Name:

    1. Enter any static value

  • Click Save

  • Return to the layout page

  • A Model is created

Model Addition

  • Select a Multi Record Model

    • In the basic config, Click + icon

    • Add the Model and click Save

  • For a single record model, the same procedure is used

Context Models

  • A Context model is created by using a multi-record model

Models Creation

  • Click on the + icon

  • Enter information, click Save

    • Criteria: Criteria determine the conditions under which the criteria apply

      • When the given criteria in the form are completed, then the criteria are fired

      • Using source types, you can add criteria in the form

      • Click on the + icon to add criteria

  • Add Criteria, click Save

//Source Type

  • On which destination do you want to compare your criteria

  • There are multiple source types available

    • Static: You can enter any (hardcoded) value

    • Input:

    • Variable: Variables are containers for storing data values in PWR Apps

      • Click + icon

      • Create Variable, click Save

        • Label: To display as a label for the field

        • Name: To uniquely identify the field within the form

        • Field Type: You can select the field type from the dropdown

          • Field: Text, Checkbox, Integer, Double, etc.

        • Required: If this checkbox is checked, the field is required

        • Is Array: If this checkbox is checked, the field is stored in the array

        • Default Value: You can set a default value for the variable

        • Variable Scope: A variable's scope determines where in a form a variable is available for use

          • The variable scope comes in 3 types

            • In:

            • Out:

            • In/Out:

    • Cookie: A cookie is a piece of data, that is stored within a web browser

    • Context:

 

 

 

Related content

Repeater
Repeater
More like this
Form
Form
More like this
Query Records
Query Records
More like this
Table
More like this
Table
Table
More like this
List View
List View
More like this