Question
Virtusa
IN
Last activity: 4 Apr 2017 2:32 EDT
Random Selection of Records
Hi All,
As part of the sample POC to my client, I'm maintaining few records in my data table ABC. Lets say 5 records. Now a particular LOB I have started my flow and system should randomly select one record from the data table ABC. Once the flows picks up records, it moves forward and goes for approver action. Lets say he has rejected it and status updated as Resolved-Rejected. Again I started flow for the same LOB, now my system should perform a random selection again and it should not select the previously selected record( bsc its same LOB) and go forward.
How can I perform a random selection of records over here from the data table? What design should I follow so that same record will not be picked up for the same LOB again?
Thanks In Advance!!!
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
Hi Mir,
I would write a sql connector to randomly select a row with query mentioned in SQL to Select a random row from a database table, depends on which flavor of DB.
=waikei
Pegasystems
IN
If you are using a report definition, please write a SQL function to get the random record.
Coforge DPA Australia Pty Ltd
AU
Hi, I tried to created SQL Function without parameters. Used source code is RANDOM(). When this 'function alias' is used in report definition, I am getting error - "pySQLFunction: Too few parameters were given for function 'RandomResults".
When existing pxCaseWhen is used after private check out and replaced its code with Random() then it is working as expected. How to resolve this error?
Virtusa
IN
Hi Thanks for the info.
But I'm using activity to read the records from the table. So my activity should be selecting random records.
Pegasystems
IN
Are you using custom SQL to read the records? Or are you using obj-browse or obj-list methods?
Virtusa
IN
I used Obj-Browse to get the records from table.
Pegasystems
IN
You could consider calling pxRetrieveReportData activity which executes a report definition and gets the results. In that case, the report definition could use a custom SQL function which can pick a random record.
Virtusa
IN
Thanks Rajiv, I will try this approach.
Areteans
AU
pxRandom function alias you may want to try.
Accenture India Pvt. Ltd.
IN
hi Mir ,
Could you please share the details of the custom SQL function that worked for Random selection of records ? Also how did you apply this function in your report definition ?
I have a similar business use case .
Thanks,Rima
Pegasystems Inc.
IN
Hi Rima,
Thank you for posting your question in the Product Support Community.
Considering the age and current status of conversation in the original thread, it’s best advised that you create a new thread for your question. This is to gather more activity and visibility for the new question on the community.
You may include the original thread as a reference in the newer thread.
Thank you for your cooperation
Regards,
Coforge DPA Australia Pty Ltd
AU
Hi, I tried to created SQL Function without parameters. Used source code is RANDOM(). When this 'function alias' is used in report definition, I am getting error - "pySQLFunction: Too few parameters were given for function 'RandomResults".
When existing pxCaseWhen is used after private check out and replaced its code with Random() then it is working as expected. How to resolve this error?
Pegasystems Inc.
IN
Hi Sreenivasa,
Thank you for posting your question in the Product Support Community.
Considering the age and current status of conversation in the original thread, it’s best advised that you create a new thread for your question. This is to gather more activity and visibility for the new question on the community.
You may include the original thread as a reference in the newer thread.
Thank you for your cooperation
Regards,