32
Views
6
Comments
Solved
How to add validations on data grid for duplicates.?
Application Type
Reactive
Service Studio Version
11.54.4 (Build 62290)

Hi, 

I have some thing like this, 

Where the user select a value from the drop down widgets and the those values will be added as a new row in data grid on "Save" button click. 

I want two properties here-

1) Want to add delete column on right side of the RestrictionState column.

2) Dont want to add duplicates in the grid. 

How do I can achieve this.?

The save on click button is -


2020-11-25 10-45-32
Mostafa Othman
Champion
Solution

Hello Keshav,

For Delete button you can add new column to your grid then add button or link to this column and make its text value "Delete".

In case you will delete from grid only and not from database you will implement delete logic inside onclick action of button by removing element from list using ListRemove action and position of element into the list.

In case you will delete it from database so implement a server action that will delete row from database entity using row Id then refresh your DataAction.


For check duplication same you can check if same element exists into list before append new element using ListAny action

UserImage.jpg
Keshav Raghav

Can you please share the demo file.? I am not able to implement this.

2020-11-25 10-45-32
Mostafa Othman
Champion

Kindly find attached sample.

Please note that In my demo I am adding new employees to displayed grid first without adding them to database and finally I am click save to database to add new employees to database.

Delete button check if the employee has Id or not (Newly created and not saved to database yet or old record which already saved to database) then if its new record just remove it from lists otherwise deleting it from database.

DeleteAndDuplicateDemo.oml
UserImage.jpg
Keshav Raghav


I am not able to publish your app, and I am using grids not tables, the "check for duplicates" work fine, but how do I can add delete column in the grid. 

2020-11-25 10-45-32
Mostafa Othman
Champion

Kindly check attached oml which has a new screen using grid

DeleteAndDuplicateDemo_WithGrid.oml
UserImage.jpg
Keshav Raghav

This doesn't work for me, as I am not using the DB entity to store data and In my outsystem I have not used columns.


HOw do I can add delete column here.?


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.