Azure: Get a row key value from a table and display it as a token number - azure

I need to get a row key value from a table and display it as a token number in logic apps. Is there any possibility for this? please let me know if any.
I have tried to get entity and display but it's asking row key as input. So I am not getting any idea what to do.

You could use Get Entities to implement it, this action supports Filter Query and Select Query
OData filter query is for which entities to return and OData select query is for the columns to be returned.
So you could in the filter query use like PartitionKey eq '001' to get the entities and in the select query use RowKey then it will only return the RowKey of all entities.

Related

Need to build a complex query for Azure Table to count number of rows

I am trying to run complex query for Azure Table where I want to count number of rows for all deviceID for specific dateiot and timeiot? Is this possible?
Your query would be something like:
PartitionKey eq 'aaaa' and dateiot eq 'bbbb' and deviceID eq 'cccc' and timeiot eq 'dddd'
2 things though:
This query will do a complete partition scan and may result in incomplete data in a single request. Your code should be able to handle continuation tokens to get all data matching the query.
Table query does not support count functionality so you will get the entities back. You will need to add all entities to get the total count of entities matching the query.

Microsoft Graph API $filter=name eq 'foo' query not working on GET workbook/tables/{id}/columns. No error and no filtering

I'm looking at a table (Table1) inside an Excel book saved on my OneDrive for Business account. I then want to get the maximum value in the CREATEDDATE column from this table.
I want to avoid pulling down the whole table with the API, so I'm trying to filter the results of my query to only the CREATEDDATE column. However, the column results from the table are not being filtered to the one column and I'm not getting an error to help troubleshoot why. All I get is an HTTP 200 response and the full unfiltered table results.
Is it possible to filter the columns retrieved from the API by the column name? The documentation made me think so.
I've confirmed that /columns?$select=name works correctly and returns just the name field, so I know that it recognizes this as an entity. $filter and $orderby do nothing when referencing any of the entities from the response (name, id, index, values). I know that I can limit columns by position, but I'd rather explicitly reference the column by name in case the order changes.
I'm using this query:
/v1.0/me/drive/items/{ID}/workbook/tables/Table1/columns?$filter=name eq 'CREATEDDATE'`
You don't need to $filter here, just pull it by the name directly. The prototypes from the Get TableColumn documentation are:
GET /workbook/tables/{id|name}/columns/{id|name}
GET /workbook/worksheets/{id|name}/tables/{id|name}/columns/{id|name}
So in your case, you should be able to simply call call:
/v1.0/me/drive/items/{ID}//workbook/tables/Table1/columns/CREATEDDATE

Azure Table Storage - Retrieving all entities matching a partial row key

I am just learning Azure Table Storage and I'm able to save and retrieve entities without any problem. However, I'd like to do the following. Say I have row keys (all with the same partition key) that look as follows:
KJV-C1-V1
KJV-C1-V2
KJV-C1-V3
KJV-C2-V1
KJV-C2-V2
KJV-C2-V3
I'd like to be able to perform two types of queries in .NET C#:
Retrieve all entities with row keys that start with 'KJV-C1'.
Retrieve all entities with row keys that contain '-C1-' in the key
Preferrably I'd like to be able to do this without reading all entities in the partition and filtering the ones that don't match the pattern I'm looking for. Is this possible with Azure Table Storage queries?
Retrieve all entities with row keys that start with 'KJV-C1'.
This is possible. Sample OData query:
PartitionKey eq 'your partition key' and (RowKey ge 'KJV-C1' and RowKey lt 'KJV-C2')
Retrieve all entities with row keys that contain '-C1-' in the key
This unfortunately is not possible. You would have to fetch all entities and filter the data on the client side.
You cannot do something like contains() over keys. But as it supports CompareTo("") method, you need to slightly modify your table design.
Maintain multiple partition keys instead of single. You can simple push 'KJV' part of your row key to partition key. Then start with C1-V1, C1-V2 as your row keys.
Then, if you want
All entries of KJV - Query for partition key 'KJV'
All 'C1' entries of KJV - Query for partition key 'KJV' and row key starting with 'C1-'
All entries for C1 - Query for row key starting with 'C1-'
OR with out design change in table, you need to loop through your major products like 'KJV' and build multiple queries with each starting with 'KJV-C1-', then union all of them to get final result.
Please mind that table storage does not allow all LINQ operations and sometimes you need to design the table keys keeping your majority of queries in mind.

How to get multiple keys in couchdb sorting by date

I have a view which emits values as
function(doc) {
var d = new Date(doc.created_date);
emit([d,doc.unique_id],doc);
}
Here i have to get multiple unique_id's in one query. so i use Keys=["unique_id1","unique_id1"] to get the id's.. but i need them to be sorted by date and also get the unique_id's. If i query as mentioned above i am not getting any results from db.but if i change the view as below and query it i am getting results correctly but not sorted by date.
function(doc) {
emit(doc.unique_id,doc);
}
Could anybody suggest me how to get both in a single query????
Select * from db where unique_id in {"1","3"} order by date
This is what i need in couchdb
You can't do that. In CouchDB, you can either query by a unique key or set of keys, or you can query for a range. So, if you want to query by a set of unique ID's without having to specify their creation date in the query, you cannot have the creation date in the key, and so CouchDB can't order by creation date for you. In that case, you could use a unique-ID-only key and sort the results by created_date on the client side (i.e. after querying).
The alternative is that you specify a key including [unique_id, created_date], but in that case you can't query for [1, *] and [3, *] without also including [2, *] (which you could again filter out after querying, on the client side).

Azure query using the select

I am trying to get a query in azure in which I want to get the entity with the given partition key and row key based on Date.
I am keeping entities
Partisionkey, row key, Date, Additional info.
I am looking for a query using tableservies so that ,
I always get the latest one (using date)
How can I get the query? (I am using node and Azure)
TableQuery
.select()
.from('myusertables')
.where('PartitionKey eq ?', '545455');
How write the table query?
To answer you question, check out this previously answered question: How to select only the records with the highest date in LINQ
However, you may be facing a design issue. Performing the operation you are trying to do will require you to pull all the entities from the underlying Azure Table, which will perform slower over time as entities are added. So you may want to reconsider your design and possibly change the way you use your partitionkey and rowkey. You could also store the latest entities in a separate table, so that only 1 entity is found per table, transforming your scan/filter into a seek operation. Food for thought...

Resources