I want to delete some records from ArangoDB UI through the length condition.
For example : For a collection, I want to delete records that are having the length of a string object as 9
FOR item IN collection
FILTER LENGTH(item.string) > 5
REMOVE item IN collection
Related
I have a partitioned Cloudant database (on the free tier) with a partition that has more than 2000 documents. Unfortunately, running await db.partitionedList('partitionID') returns this object:
{
total_rows: 2082,
offset: 0,
rows: [...]
}
where rows is an array of only 2000 objects. Is there a way for me to get those 82 remaining rows, or get a list of all 2082 rows together. Thanks.
Cloudant limits the _partition endpoints to returning a maximum of 2000 rows so you can't get all 2082 rows at once.
The way to get the remaining rows is by storing the doc ID of the last row and using it to make a startkey for a second request, appending \0 to ask the list to start from the next doc ID in the index e.g.
db.partitionedList('partitionID', {
startkey: `${firstResponse.rows[1999].id}\0`
})
Note that partitionedList is the equivalent of /{db}/_partition/{partitionID}/_all_docs so key and id are the same in each row and you can safely assume they are unique (because it is a doc ID) allowing use the unicode \0 trick. However, if you wanted to do the same with a _view you'd need to store both the key and id and fetch the 2000th row twice.
I needs to update the Mongodb whole collection according to the data on my website.
Schema({ title: "data" }).which_function_should_I_call
when I call the first time it has 20 data item update the collection 20 documents - collection documents length should be 20.
after the second call data has 5 data item the collection length should be 5 documents.
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.
I have 2 collections in which I get data from DB.
Collection 1 column names: A_id, Bid, PCid, Bname ==> all text fields
Collection 2 column names: A_ref, Cid, Cname, value ==> all text fields
Collection 1 and 2 are related based on collection1.A_id=collection2.A_ref
I have a 3rd collection which is a nested collection:
Collection 3 Column names: action(text), colA (collection)
colA column names: Bid(text), PCid(text), Bname(text), colB (collection)
colB column names: Cid, Cname, value ==> all text fields
I want to join collection 1 and collection 2 based on mentioned condition to load the nested collection 3.
Please help.
I have tried using the collection VBO but didnt succeed. I also tried using a nested loop stage and counters with a decision stage but my code fails to add empty row to the nested collection before populating the values.
Using Blueprism stages
I want to join collection 1 and collection 2 based on mentioned condition to load the nested collection 3.
I am using a nested loop stage and counters with a decision stage but my code fails to add row to the nested collection.
Aswin, please check the solution below:
For further information, i will pass the XML file as for you to import to Blue Prism and check every stage, since it would require a lot of time and screenshots to explain everything. Plus you will have a clear understanding of every step in your environment.
Download XML file from my github repository link:
Blue Prism Merge Collections to populate a nested-collection
Hope these information will be useful.
I believe what you're looking for is what I call a "box join". You'll need a code stage.
Inputs:
Main (collection)
Nested (collection)
Main Key (text)
Nested Key (text)
New Field Name (text)
Outputs:
Output Collection
Code:
' Check for requirements: key columns exist, and that the new field to create in the main
' collection does not already exist.
If Not Main.Columns.Contains(Main_Key) Then
Throw New Exception("Main Collection does not contain the key column '" & Main_Key & "'")
Else If Not Nested.Columns.Contains(Nested_Key) Then
Throw New Exception("Nested Collection does not contain the key column '" & Nested_Key & "'")
Else If Main.Columns.Contains(New_Field_Name) Then
Throw New Exception("Main Collection already contains a field named '" & New_Field_Name & "'")
End If
' Add the column containing the DataTable which will be populated with data from the Nested collection.
Main.Columns.Add(New_Field_Name, GetType(DataTable))
For Each MainRow As DataRow In Main.Rows
' Create the new nested table for this row and populate the column names.
Dim Table As New DataTable
For Each NestedColumn As DataColumn In Nested.Columns
Table.Columns.Add(NestedColumn.ColumnName, NestedColumn.DataType)
Next
' Because we don't want to copy the key column.
Table.Columns.Remove(Nested_Key)
' Check each row in the Nested collection to see if it matches current key.
For Each NestedRow As DataRow In Nested.Rows
If MainRow(Main_Key) = NestedRow(Nested_Key) Then
' Got a match; add the row from Nested into the new table.
Dim NewRow As DataRow = Table.NewRow
For Each TableColumn As DataColumn In Table.Columns
NewRow(TableColumn.ColumnName) = NestedRow(TableColumn.ColumnName)
Next
Table.Rows.Add(NewRow)
End If
Next
' Set the nested collection
MainRow(New_Field_Name) = Table
Next
Output_Collection = Main
Using the example from the question, you'll want to pass the following into the code stage inputs:
[Collection 1] -> Main
[Collection 2] -> Nested
"A_id" -> Main Key
"A_ref" -> Nested Key
"colB" -> New Field Name
The resulting Output Collection will contain the fields from Collection 1, with an added column "colB" which contains the fields (excluding the key) from Collection 2. From there, a calculate stage can get the results into Collection 3.
My couchDB document key is like:
["2016-05-01","1"],
["2016-05-02","2"],
["2016-05-03","1"],
["2016-05-04","2"],
["2016-05-04","1"],
["2016-05-05","1"],
["2016-05-05","6"].
My question is that, how can I query to this key to get the result between 1-5 date for item id 1.
You will have to reverse the order of the keys and then query the view:
http://......../view?startkey=[1,"2016-05-01"]&endkey=[1,"2016-05-05"]