Blue Prism - How filter a collection using NOT operator - excel

I need to filter a collection that have "HoldingSubholding" column, that can have lot of different value. I need All the rows with the values except the rows that have value "A".
How can I filter the collection?
I would like to use EQUAL NOT, how could i write that?
"HoldingSubholding =NOT 'A'"
enter image description here

There's a VBO from the digital exchange, utility-collection manipulation. It has an action called filter collection- Input the collection and the filter expression "HoldingSubholding <> 'A'"
Or you can use a loop stage to loop through the collection, and a decision stage to check the condition [Collection.HoldingSubholding] <> "A"

“[Column Name] <>’A’”
<> is exact opposite of = which allows you to deselect or filter out non relevant Data in columns.

Related

Is there a vbo to get value from a collection based on value of other fields and save it as a data item?

Relatively new to Blue Prism,
I have a collection that looks like this, with 100+ rows:
Results
Answer
Timestamp
8 Apr 2021
Name
ABC
I'd like to manipulate the data such that if Results = 'Name', Get the Answer (aka ABC) and put it into a data item.
Is there any way to do this?
I understand I could hardcode i.e. Get value based on Row Index and Column Index, but my data is complex and may not always have the same rox index.
Can you use the collection filter to get a collection output? The utility has an action to filter where you can input a collection and then use
[FieldName] Like "some value"
This would result in every complete row in the collection that matches the filter.

"Does Not Contain" text filter filters too much

By using Power Query, I have created an address list from address fields in approx. 15000 individual excel files.
I now have a list with 15143 rows but I have run into problems with the "Does Not Contain" Text filter.
I want to keep rows that do not contain the search term "foo" in a specific column.
When I first use the "Contains" "foo" Text Filter it returns a list of 150 rows
But when I use the "Does Not Contain" "foo" Text Filter instead the list is shortened to only 3218 rows.
A bit unexpected result...
If I recall my maths lessons correctly 15143-150=14993, not 3218.
This is driving me nuts!
Do I do something wrong or is it the Almighty Microsoft Bug that has hit me, once again?
This behavior is related to the expected Sql logic for null: if a row field is null, it doesn't contain "foo" but it also doesn't not contain "foo". Put differently, a WHERE filter skips rows that evaluate to null, and not null is also null.
You can see this in Power Query:
let
Source = Table.FromColumns({{null, "foo", "bar"}}),
FilteredRows = Table.SelectRows(Source, each
not Text.Contains([Column1], "foo") or Text.Contains([Column1], "foo"))
in
FilteredRows
... only returns the last two rows.
In Power Query if you want to avoid this bizarre kind of logic, you can replace null with empty string and then you get nicer behavior:
= Table.ReplaceValue(Source,null,"",Replacer.ReplaceValue,{"Column1"})

PostgreSQL: how to take query results and change them on the fly before saving to file

I want to know how to take query results and change them in to human talk.
For example:
Select backup_set.id, backup_set.status, backup_set.type
from backset.table
Then take the backup_set.type result, which is usually a number such as 1,2,3,4,5 and change it to something like SUSPENDED, SCHEDULED etc... But I dont want to change the data in the table just the output.
This can be done using a CASE statement.
Select backup_set.id, backup_set.status,
case backup_set.type
when 1 then 'SUSPENDED'
when 2 then 'SCHEDULED'
else 'UNKNOWN'
end as "type"
from backset.table
But it would be better if you stored that information in another table and make the type column a foreign key to that lookup table. Then you can use a simple join to retrieve the description.
Edit
If you want to replace UNKNOWN with the actual numeric value, you just need to put that into the ELSE part. You need to cast the number to a text value though:
Select backup_set.id, backup_set.status,
case backup_set.type
when 1 then 'SUSPENDED'
when 2 then 'SCHEDULED'
else backup_set.type::text
end as "type"
from backset.table

How to add a field from a 2nd form?

I'm modifying an existing Lotus view to include a field from another form.
I first appended a new column and set it to the desired field. However, after I refreshed, the new column was blank even though I know it has data.
I then updated the View Selection formula from:
SELECT Form = "A" & StatusIndex < "06"
to:
SELECT (Form = "A"| Form = "B") & StatusIndex < "06"
Still no luck. The view is refreshing successfully, but the new field is still blank. What else is there to add this new column to this view?
This is my first time experimenting with Lotus, so if I seem to be missing some major concept, I probably am.
Edit
If I was pulling this data using SQL, the statement would probably be something like:
Select A.* , B.*
from A inner join B on A.id=B.id
where A.StatusIndex < "06";
Which brings up another question: Where is the relationship between these tables/forms defined?
Unfortunately, there is no (intrinsic) "join" functionality available from a Notes view. If you absolutely need the different columns appearing in the same row (document) in a view, then one option is to de-normalize the data, such that upon saving of "Document B" you update the related "Document A" with the necessary field values. (This is also the only real way to get full-text searches to work across "joined" data).
If the view is for display on browsers only, then you may have other options, such as making AJAX calls to load the related data fields, etc.
Here's a trick for adding multiple forms. This way you can easily add to the list of forms allowed without lots of OR statements.
#IsMember(Form; "A":"B") & StatusIndex < "06"
What I would try next, though, is to get rid of all conditions in your view and just show Form = "B", assuming the B form has the field you added in step 1. If that works, then you know it is just an issue with the view selection formula.
Also you can use the Document Properties to inspect document items. File > Document > Properties gets you there. I would triple-check that the documents that appear in that view do in fact have some data for the field in step 1.
Lastly, make sure the programmable name for the column in the view is unique. Double click the column header in the view designer, and then click on the last tab (beanie hat). The name that is there usually will be the same as the field you want to show in the column, or it will be a $number if the column value is a formula. You can change that name to something you know is unique just to be safe. The theory here is that if that programmatic name matches another column's programmatic name, then the view will not evaluate the column values and instead will used cached values, which in your case might be blanks. It's rare, but it does happen.
There is a simpler version of the 'multiple form' trick noted by Ken:
Select Form = "A":"B" & StatusIndex < "06"
or if you prefer:
Select (Form = "A":"B") & StatusIndex < "06"
This formula says: if (form = A or B) AND StatusIndex < "06"
Note: Be sure StatusIndex is Text (as you've quoted it) and the field StatusIndex with a value is included on both forms. If not, you need to fix your logic.
Plus: Documents display in a sorted or chronological order, ONE to a line, so you cannot have A & B data on a single line. It may look like:
A
A
A
B
B
B
OR
A
B
A
B
A
B
A
But never
A & B
A & B
A & B

Complicated condition

I have predefined item combination (for example brand1|brand2|brand3 etc) in the table.
i like to collect brands and check against with predefined table data.
For example i collected brand1|brand2|brand3 then i can do get some value form that predefined table(it meets the condition).
How can i check?
brands would be unlimited. also brand1|brand2|brand3 of brand1|brand2| exist then returns true.
Okay, taking a wild guess at what you're asking, you have a delimited field with brands in them separated by a | character. You want to return any row that has the right combination of the brands in there, but don't want to return rows with, for example, brand "testify" in them when you search for "test".
You have four search conditions (looking for brand3):
the brand exists by itself: "brand3"
the brand starts the delimited field: "brand3|brand4|brand6"
the brand is in the middle of the field: "brand1|brand3|brand6"
the brand is at the end of the field: "brand1|brand2|brand3"
so, in SQL:
SELECT *
FROM MyTable
WHERE BrandField = 'brand3'
OR BrandField LIKE 'brand3|%'
OR BrandField LIKE '%|brand3|%'
OR BrandField LIKE '%|brand3'
Repeat as required for multiple brands.

Resources