Manual Creation Of Index

 Hi All,

In this blog we will see how to create manual index for Custom case ID like T-30806-1 . Here 30806 is Case ID suffix.  For ex Case ID = C-30806




First create one Index Data Class.

Class Name = Index-C-C-A-Data-DeliverablesList

Class type = Concrete

Created In Version = 01-01-01

This class = does not belong to a class group


Keys

pxInsIndexedKey          Handle of work object

pxIndexCount                Index count

pxIndexPurpose             Purpose


{unchecked} Find by name first (Pattern)

Parent class (Directed)

Index-


In backend some of the main columns we have as :

pxIndexCount = 19

pxIndexpurpose = Index_DeliverablesList

pxInsIndexedKey = C-C-A-Work C-30806

ReportID = T-30806-19

TName = test


Now Create Data Pages

Data Page = D_MaxIndexCountValue

Structure = List

Object Type = Index-C-C-A-Data-DeliverablesList

Mode = Read-Only

Scope = Thread

Source = Report definition 

Name = MaxIndexCountValue


Refresh strategy = {checked} Reload once per interaction

Page options = {checked} Limit to a single data page

Parameter =>  CaseID          String         In


Report definition 

MaxIndexCountValue

Class = Index-C-C-A-Data-DeliverablesList

Query

.pxIndexCount            Index Count            Max


Edit filters

F2      .pxInsIndexedKey        is equal        Param.CaseID


Parameters

CaseID                 Text


Now create another Data Page

Data Page

D_TMaxIndexCount

Structure = List

Object Type = C-C-A-Work-TrueUp

Mode = Read-Only

Scope = Thread

Source = Report definition              Name = CaseCountForCCase


Report Definition

ID = CaseCountForCAMCase

Query

GetTUCaseNumberFromCAMCase [.pyID]


Edit filters

F1           .CID       Is equal          Param.CID


Parameters

CAMID                 Text


Here, GetTUCaseNumberFromCAMCase is Function Alias


Functions Alias = GetTUCaseNumberFromCAMCase

CL = Embed-UserFunction

ID = GetTUCaseNumberFromCAMCase


Reference

P4                  CaseID              Text                   Autocomplete


Presentation

Return type = integer

Category = Numeric

Pattern template = Case ID{1}

Echo template = Case ID{1}

Output format = Integer


Source

TO_NUMBER(TRIM(REGEX_REPLACE({1},'TU([-][0-9]+[-])([0-9]+[-])*','')))


Now create Activity

Activity

ID = AddNewTCase

CL = Index-C-C-A-D-DeliverablesList


Steps


1) Page-Remove

D_MaxIndexCountValue

D_TMaxIndexCount


2) Property-Set

Param.DelDate = .DelDate

Param.BookingCompletionDate = .BookingCompletionDate


3) Property-Set

Param.CInsKey = pyWorkPage.pzInsKey

Param.CId = pyWorkPage.pyID

Param.IndexCount = D_MaxIndexCount[CaseID:Param.CInsKey].pxResults(1).pySummaryValue(1)

Param.TUIndexCount = D_TUMaxIndexCount[pyID:Param.CId].pxResults(1).pySummaryValue(1)


4) When  

@contains(Param.CInsKey,"BOOKING")       if true = Continue Whens       if false = Skip Step


Param.IDPrefix = "T-"+@substring(Param.CAMInsKey,"39")


5) Property-Set

Param.IDPrefix = "T-"+@substring(Param.CInsKey,"27")


6) Property-Set

Param.TIndexCount = Param.TIndexCount+1


7)  Property-Set

.pyID = Param.IDPrefix+"-"+Param.TUIndexCount


8) Property-Set

NewDelPg.ReportID = .pyID

NewDelPg.pxInsIndexedKey = Param.CInsKey

NewDelPg.pxIndexPurpose = "Index_DeliverablesList"

NewDelPg.pxIndexCount = Param.IndexCount+1

NewDelPg.DeliverableName = "T-Up Report"


9) Apply-DataTransform

Data Transform = MapNewTDel


10) Call Save            NewDelPg


11) Call CommitData           NewDelPg


12)  Call GenerateNewTUCase


13) Label = End


14) Label = PR        Page-Remove

NewDelPg


Thank you!! Will see you all in next blog post 😊.

Comments

Popular posts from this blog

Frequently Used Date Expressions In Pega

pxSubscript and pxListSubscript Properties In Pega

pyForEachCount In Pega