Pre-selecting items in multi-select list in Constellation

https://players.brightcove.net/1519050010001/default_default/index.html?videoId=6371300948112

Why

In many applications, tables are used to display data in an organized manner, allowing users to interact with and manipulate the information presented. Preselecting rows in a table using a data transform can enhance user experience by streamlining workflows and minimizing manual input. This support article will guide you through the process of preselecting rows in Embedded and Data Reference tables, utilizing data transforms to automatically highlight specific records based on predefined criteria.

Business use cases

  1. Improving Data Consistency: By programmatically selecting rows based on specific rules, you can ensure that users are consistently viewing and interacting with the same set of data, reducing the risk of errors.
  2. Enhancing User Experience: By preselecting rows that match certain criteria, users can quickly identify important records, improving the overall efficiency and effectiveness of their interaction with the application.
  3. Facilitating Batch Operations: In scenarios where users need to perform batch operations, such as approving or rejecting multiple entries at once, preselecting relevant rows can significantly reduce the number of clicks and streamline the process.

Prerequisites

Before implementing preselection of rows, ensure that your data model is set up.
In this example we will be using a File data object with the following fields:

  • IsSelected - indicates row selection, you could alternatively reuse pySelected from baseclass
  • Name – filename without extension
  • Type – file extension
  • URL – dummy link to the file

Pega is system of record, therefore pyGUID will be the primary key.

It’s important to have a clear understanding of your data structure as it forms the basis for the data transform logic.

Implementation

Now I will do my best to explain the topic by splitting it into 3 areas:

  1. Data Model and Case Type

  2. UX configuration

  3. Preselect and data population Data Transforms

Data Model and Case Type

To showcase preselection, the workflow includes two fields based on File data class. This configuration helps to clarify the differences between managing data that is embedded directly in the case and data references that access other sources.

Let’s begin with the Embedded Files field. Since this is a property requiring manual data access, it must first be populated with data saved within the case itself. Note that embedded fields do not provide an out-of-the-box multi-select input mode. Therefore, the IsSelected Boolean property defined in the File data class will be used instead.

The situation differs for the Data Reference list. This list does not require options stored within the case, as it sources from a list structure Data Page. The Data Reference Files field actually stores a list of references (pyGUIDs) to the D_Files Data Page. Hence, the whole table displayed in the user interface is not stored within the Data Reference Files—only selected items are stored. The IsSelected or pySelected properties are not applicable here; instead, the Data Reference Files list will be populated with pyGUIDs that should be pre-selected.

The case type is designed to be very clear, showing that data transforms responsible for preselection are executed before the Collect Information steps. These data transforms can also be applied through the Configure View > Pre/Post Processing tab on Collect Information steps or via the Flow Action configuration in Dev Studio.

UX configuration

Because the IsSelected column is used to mark selected items, the entire Embedded Files field is set up as an editable table. The other columns are read-only to prevent any alterations to the data (unless your specific solution requires it).

In this demonstration, labels and captions are hidden to make the table’s appearance align more closely with the default multi-select control, basically to improve the look on screenshots. However, remember that prioritizing accessibility over aesthetics is considered a best practice.

The configuration of the Data Reference view is relatively simple, as it leverages Constellation’s multi-select mode. The table is populated from the List Files (D_FilesList) data page, which uses dummy records added during the creation of the File data object.

Preselect and data population Data Transforms

  1. Embedded data use case

As previously emphasized, embedded data must be within the case to be operated on. For this case study, preselection will rely on the file Type.

See the Data Transform logic below:

Step 2. Iterates over D_FilesList, which is the list of our dummy records

Step 2.1 When condition determines the file type

Step 2.1.1 When above condition is met (file type is “txt”), IsSelected flag is set to true

Step 2.2 Otherwise, IsSelected flag is set to false

Step 2.3 Appends the current record and thus builds the .EmbeddedFiles list, which includes IsSelected field.

The list’s further processing and any bulk actions should involve the .IsSelected Boolean property to determine if an item is selected.

  1. Reference data use case

Regarding reference data preselection, there is no need to initially populate the list separately, nor do we use the supporting IsSelected property.

Let’s consider two scenarios (S1 and S2), each working independently to preselect certain items.

Scenario 1 (S1) – we will reuse embedded files list, as it is already populated:
What is important, appended page having its pyGUID

Step 3. Iterates over .EmbeddedFiles list

Step 3.1. When condition determines the file type (file type is “pdf”)

Step 3.1.1. When above condition is met, the whole page is appended to DataReferenceFiles.

Scenario 2 (S1) – to highlight that in data reference fields we require only the key properties

Step 4. Iterates over D_FilesList page list

Step 4.1. When condition determines the file type (file type is “txt”)

Step 4.1.1. When above condition is met, the TempPage is initialized with only the pyGUID property.

Step 4.2 TempPage having only the pyGUID is appended to the DataReferenceFiles list

Conclusions

Equipped with this knowledge, you can effectively implement preselection through data transforms or activities. This approach can be further extended, enabling you to address sophisticated business scenarios, whether involving embedded or referenced data, and to optimize user experience or automate workflows.

Constellation 101 Series

Enjoyed this article? See more similar articles in Constellation 101 series.

Hi @KubaP

I had a doubt regarding multi-select in a Data Reference field in Constellation. In traditional UI, the selected rows are stored under the pySelected property. I wanted to check if it’s the same in Constellation as well, or if the selected rows are stored differently. When I select multiple rows, I want to copy those selected rows to another embedded property using a data transform. Could you please let me know which property holds the selected rows in Constellation

Thanks in advance!

Hi @RanjithNarsini,

All the items in your Data Reference field are the ones that are selected. So if I got you right, you should copy everything from Data Reference to your Embedded property.
In Constellation’s multi-select, if item is not selected then it is not on Data References list.

Hi @KubaP,

Thank you so much for your help! It worked perfectly and resolved my issue. Really appreciate your support and time

@KubaP We are displaying list of available train seats in a table using Data Reference multi select option. I have a requirement that if one user select a seat A1 record from table did not complete transaction then A1 seat should be disabled for other user. Would it be possible in Constellation implementing this scenario? If yes, could you please through some lights on it.

Hi @MS91781
Sadly, I can’t share a PoC at this time, but I hope it won’t be needed:

I would start with a property in your data model, either reuse the existing update date or add your own lock date and time.
Then you can try the disable when condition to block such seat on your default Data Page or maybe a better approach would be to source the seat list from a separate Data Page - one that is sourced with available seats only.

As always, there may be several ways to approach such scenario, hope this helps :slight_smile:

Hi @MS917810**, were you able to find a solution for that requirement?**

@KubaP My scenario is like if i have 20 rows in the data reference multi select and if i select 2 rows i need to copy those to rows to other embedded property so which property holds the value like pySelected

@RanjithNarsini, well, as I mentioned, just copy all records from Data Reference to Embedded with a Data Transform.

Let me try to explain once again - My data reference field is DataReferenceFiles and it stores only selected items, therefore pySelected is redundant. This is how Data Reference works in Constellation.

So looking at the screenshot below, payroll and order_list records are displayed in the UI, but they are not stored in my DataReferenceFiles property, because they were not selected to be on that list.

Just try it and see how it goes :slight_smile:

Hi @KubaP

Thank you for you notes. I have a follow up question, we can use a property to use a disable condition, but how can we set that property value on selecting seat[check box]. Form Refresh is not helping as it works only for scalar properties. I have tried with Declare expression and declare on change but did not work. Could you please let me know is there any way to achieve this.

@HemanthKumarI16760486 I did not find a solution for it

@MS91781 @HemanthKumarI16760486

Apologies for the delay in a reply. We have an Expert Circle that is dedicated to all things Constellation. Would you mind asking your question over there and one of our Expert Circle Leaders will reply to you?

Let me know when you’ve posted the question and I can follow up!

@KubaP Is there a way to display only the selected values to the top of the list

Hi @ParvathySuchetha

This is an older post and you may not receive a reply to your question. Alternatively, you can join our User Experience Expert Circle and ask your Constellation question there and one of our experts will assist you.

Thank you!

@ParvathySuchethaI don’t see any issues with that, should be possible.

You can always add sorting on “IsSelected”, e.g. in response data transform, however if you want selected rows only, then I would suggest copying them to another embedded property - really depends on the scenario and what you intend to do with that data later, hope this helps :slight_smile: