How to find the Row index in collections in BluePrism? - blueprism

I am trying to find a value in collection using "collection contains value" action in Collection manipulation VBO. I want to read the row index of the value read. Can someone guide me.

There are two methods to completing this:
Loop over your collection and compare the search term to each Collection item. This is computationally expensive (especially for large collections), but it will yield you the right result with minimal development time.
Modify the Collection Manipulation object - Duplicate the pre-existing "Filter Collection" Action from the Utility - Collection Manipulation object, and modify the code stage that leverages the previous calls to DataTable's select and utilizes it against the indexOf functionality to retrieve the index of the row you're searching for (relevant SO link). This is ideal for larger collections and would seem to me to be generally more sustainable long-term.

Related

Concatenated SQL fields in selector and/or custom PXDimension

We have a set of BLC/DAC for a customization that has multiple tables with the given relationship
Table1 - T1ID (int-autoincrement), T1CD (char-substitute key)
Table2 - T2ID (int-autoincrement), T2CD (char-subsitute key), T1ID (reference to T1ID)
where the records in Table2 are unique for each given T1ID selected.
The initial design specification was for the users to select first the Table1 value, then the Table2 value (UsrTable1Value, UsrTable2Value respectively) in the data entry screens.
The users have recently asked if it's possible to combine these into one field simular to a Dimension selector so that there is one field resulting in "Table1-Table2" stored as T2ID.
My first thought was to simply create a subclassed dac with a concatenated property for T1CD-T2CD and base the substitute key off that however performance is a problem when that is done (1.6 million records). The delay is in the framwork side as it appears it processes the entire recordset when generating the concatenated substitute key.
Based on that I thought perhaps instead to simply generate a PXDimension configuration for this however I can't find any reference to make Dimension 2 rely on the value of Dimension 1.
I know i could always create a view that does this but i'd prefer to keep it within the framework if possible.
That basically brings me to two questions
1) Outside of a view, is there way to concatenate fields in the BQL so the lifting is done on the SQL and not with a calculated property?
2) Does anyone have or know of a sample of custom Dimensions where the values in level 2 depend on the value in level 1?
Any suggestions would be appreciated.
Out of the box, dimension selectors are designed to work only with Segmented Keys and won't be able to handle values from multiple tables. In theory, it can be possible to populate segment popup from different tables within a custom DimentionSelectorAttribute. However, this will additionally require to store each T1ID/T2ID pair in a separate table with some other column declared as a key (same concept used in the Sub table to store sub accounts: SubID is a key and SubCD stores values composed from multiple segments).
My personal opinion, the effort is just not worth it. Going one step further, I would check with the customer on how they expect navigation buttons (first, prev, next, last) to work with their segmented input control? If following standard Acumatica UI design with separate input created for every key field, no additional effort is needed to properly handle both data entry and navigation.

How to create a view using a count of certain field

I am trying to create a categorized view of all Notes documents that have a field with exact same value, i.e. there is a field for Contractor Name and I want to create a view that lists each Contractor and the documents that relevant to each. How do I do this? I have tried view formulas like the following but no success as yet
SELECT #IsAvailable(Contractorid) & #Count(Contractorid) > 1
SELECT #Count(#IsAvailable(Contractorid)) >1
Nsf databases are no relational databases. The count of different documents with a unique value in a specific field cannot be used to build a view selection formula.
You could write an agent, that runs through all documents and counts them and puts all with count > 1 in a folder, but this is quite a lot of LotusScript code and needs some advanced knowledge.
The other possibilit would be to categorize the view by ContractorId and add one column before that categorized column: simply use 1 as column formula and select "display totals" in the column properties as well as "hide details".
Then at least you have the information, how much documents are in each category, but unfortunately you cannot filter by it and you cannot sort by this column.
A third possibility would be to use an xpage interface, but that is even more work to do and a completely different story developmentwise.
This is similar to view to identify duplicates. My approach is to use folder.
Make a new folder with design of your view. Instead of (not working) selection formula use short LS code as an action, or QueryOpen event (make sure only one user runs the script).
The code should cooperate with another (hidden) view sorted by Contractorid. Make a ViewNavigator for that view and traverse through it with simple logic - if previous entry has the same Contractorid as the current one, put both documents into folder**. That way you will get list of all documents with duplicate Contractorid. Make sure to wipe all the current content from the folder at the start.
** This can be optimized further by slightly more complicated algorithm to handle first duplicate diferently - for more than two duplicates this algorithm makes extra calls of PutInFolder method.

Filtering a repeating table linked to a secondary datasource

I have an infopath form based on a sharepoint list (worktracker).
In that form there is a repeating section which holds data from a secondary source which is the worktracker list again.
I would like to filter that table using the value in a field on the form - this enables me to run a check on duplicate items on the list by using a calculated checking reference.
I have done this by using conditional formatting to hide the non-matching items but that this killing my form as IE throws tantrum as it takes too long.
Does anyone know another way to do this? I am stuck using IE8 - not my choice!
UPDATE:
So since posting the above, I had since tried using a REST connection which doesn't work as my list is too big. I have also tried using an XML connection to a filtered view and that didn't work either!
Cheers,
In the form, select the value field. Create a rule that sets the secondary data source's query field of the same name to that value. Then query the secondary data source. It will only return the items where the value matches.

tag count on collection

I want to copy feature from stackexchange sites: every time you have list of questions, on the right side there is a list of all tags presented in them, including their count (frequency).
Is there any performance friendly way, how to obtain this kind of information without iteration through every element in view? Let's suppose it should work with common view data source, and content of the view can be altered by filter (keys, category) or fulltext.
I have already have considered (and refused) few solutions:
Iterate through collection - unusable for performance reasons (especially if ViewNavigator can't be used - FT query).
Counting tags in rendered content - limited to visible page only, tags for other pages are not counted (stackexchange counts tags for every page). Good performance though.
DocumentCollection.intersect - iteration through all tags and intersecting collections of all documents with that tag against source collection would result in count of documents with such tag. This approach is performance killer.
You could use a categorized view with a summary column and query it in json. Needs to be collapsed. ?ReadViewEntries&Outputformat=json
I would consider two basic approaches:
Store the tags in a multi-value summary text field in your question documents, create a categorized view based on that field, open the view, create a NotesViewNavigator, use CreateViewNavFromCategory to create a NotesViewNavigator that only contains the documents that match the tag, and get the NotesViewNavigator.count() property value.
Store the tags in a field (it can be multi-valued or single-valued, summary or non-summary text or even a rich text field) in your question documents, full text index the database, and use the Database.FTSearch method with a search formula that uses the FIELD keyword to get a NotesDocumentCollection, and use the NotesDocumentCollection.count() property.
For filtering, I think the latter approach may be better. You might be able to just revise your FT query to include additional conditions to accomplish the filtering. This could be very flexible, and should be pretty fast. With NotesViewNavigator, on the other hand, you would have to iterate through the NotesViewEntry objects in order to do the filtering.

Solr schema and boosting by keywords/tags for item

When users searches and clicks a result, we store this search keyword in the DB.
What we get is a list of keywords for every item with the number of times item was clicked for that keyword.
In solr schema I have multivalued field "keywords". How can I add that number of clicks for every keyword on every item and than boost so the most clicked items are on/near the top of results for that keyword ?
I use dismax and for the moment the query for "apple" looks someting like this:
q=apple
qf=title^0.4 keywords:"apple"^0.5
bf=hits^0.4 rating^0.3
So as you can see I boost by "keywords" but the problem is that I don't know which item was most clicked for "apple".
I've tried adding boost parameter to every keyword on initial index import. It didn't help and I'm out of ideas.
How are you maintaining the clicked data ?
How about also maintaining the cumulative clicked data as a single field with the document.
You can easily use this field to boost the documents overall using the dismax boost functions.
A large set of mathematical functions can be used # http://wiki.apache.org/solr/FunctionQuery#What_is_a_Function.3F

Resources