Can not pass two parameter on azure table storage within azure function.

What I have tried:

My parameter on function:

        // convert all request perameter into Json object
        var content = req.Content;
        string jsonContent = content.ReadAsStringAsync().Result;
        dynamic requestPram = JsonConvert.DeserializeObject<Product(jsonContent);


        // extract each param
        string product = requestPram.product;

        string version = requestPram.version;

My storage query

 var query = new TableQuery()
                {
                    FilterString = TableQuery.GenerateFilterCondition("ProductName", QueryComparisons.Equal, product),
                    SelectColumns = new string[] {
                    "ProductName","EntitledProductsCurrentPrevious","MainstreamSupportEndDate"
                },
                    TakeCount = 200
                };

Here I have passed on param "product" Its work fine and return expected data. but I want to pass also version . Similar like sql WHERE product = 'proudctname' and version = 'versionName'

Just Like following TSQL

SELECT Product,EntitledProductsCurrentPrevious,MainstreamSupportEndDate 
FROM BotProductList 
WHERE Product = 'Microsoft Dynamics CRM' AND 
EntitledProductsCurrentPrevious = '2016'

I have followed below reference:

reference_1

reference_2

reference_3

But Still cannot solve it.

Any help will be appreciated. Thanks in advance.

2 Answers

1
Md Farid Uddin Kiron On Best Solutions

After many struggling I have solved this problem in below format:

var query = new TableQuery()
                {
                    FilterString = string.Format("PartitionKey eq '{0}' and RowKey eq '{1}'", product, version),
                    SelectColumns = new string[] {
                    "ProductName","EntitledProductsCurrentPrevious","MainstreamSupportEndDate"
                },
                    TakeCount = 200
                };

It also reduced some line of code.

1
Zhaoxing Lu - Microsoft On

Try string finalFilter = TableQuery.CombineFilters(productQuery, TableOperators.And, versionQuery); instead.