New Purchase Page - Logic for Data Variables
New Purchase Page - Logic for Data Variables
- Go to Variables > DATA VARIABLES
- Add 2 data variables: A_ProductBasicText and Customers
Note
: Please make sure that you have same data variable names in your screen:
- Select Customers1 data entity. Select the [X] icon under Filter condition.
- Select Object with Properties
- Add a condition:
- Property: customerNumber.
- Condition type: equal.
- Select the ‘123’ icon under Compared value
- Go to Formula > Select into the Formula field
- Enter the formula below and Save the formula afterwards
1
INTEGER(params.SelectedCustomerNumber)
- Save the condition
-
Switch to User Interface.
-
Drag & Drop the UI Components with the following order:
- Dropdown field
- Input field
- Button
-
Switch to VARIABLES > PAGE VARIABLES
-
Create 2 Page Variables
- Variable 1: Name: PurchaseValue Variable Value type: number
- Variable 2: Name SelectedProduct Value type: text
-
Select Save
-
Switch back to User Interface then:
- Select Dropdown field.
- Rename the Label text: Select Product.
- Select the ‘[ ]’ icon under Option list.
-
Go to Formula
-
Enter the formula below
1
MAP(data.A_ProductBasicText1, {label:item.Product, value:item.Product})
- Save the Formula
- Select the X under Selected value
-
Go to Data and Variables > Page variable > SelectedProduct > select Save
-
Select Input field and Rename label: Purchase Value
-
Select the ‘X’ icon under Value
-
Go to Data and Variables > Page variable > PurchaseValue
-
Select Save
-
Select Button > Rename label: Add Points!
-
Open Logic Canvas
-
Drag & Drop the logic components below to create the logic and join each component.
- Create record
- Alert
- Navigate back
-
Select Save
-
Select Create record function > Select the data entity Purchases and Save.
-
Select the Custom Object
-
Select the ABC icon under ID > Formula
-
Select the Formula bar.
- Enter the following formula and Save:
- Select the [X] icon under customer_ID > Formula > Create formula
- Enter the following formula and Save:
- Select the [X] icon under purchaseValue > Formula > Create formula
- Enter the following formula and Save:
1
INTEGER(pageVars.PurchaseValue)
- Select the [X] icon under selectedProduct > Data and Variables > Page Variable > SelectedProduct
- Save the window
- Select Alert component > Select the ABC icon under Dialog title > Formula
- Copy and Paste (as plain text) the formula below > Save
1
data.Customers1[0].name + " has successfully earned " + outputs["Create record"].response.rewardPoints + " points!"