Get filtered table list thru api (v2021)

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
Andros
User
Posts: 111

Get filtered table list thru api (v2021)

Post by Andros »

Hello, with ANM21 I need to get a table record list thru api, filtered on ONE or MORE fields.
If I run the GET LIST all is ok and I can get the JSON with all records.
How can I filter the list to get filtered records? Which is the correct syntax? There isn't any example in the docs.
Referring to the online doc: <Field>=<FieldValue> (Optional, search field by value, requires activating the Advanced/Extended Search setting in List page):
1) <Field> is the real db field (CustomerID) or something like x_CustomerID ?
2) which is the correct setting to setup? "Ext. Search" flag at field level or (Search) Extended or Advanced at table level? Or maybe the twos?
3) in the following example in my "documents" table I want to get all the documents with CustomerID=100 (is numeric) AND with DocDate BETWEEN two values: how can I pass the field parameters to the ajax call? with data?
4) It is impossible to create OR based fields search, right? If I specify more fields to search I always have AND condition, right?
Thank you

$("#btn-list").click(function() { 
		$.ajax({
			url: "https://www.mysite/api/list/documents",
			method: "GET",
			data: { CustomerID:"100"}, // this doesn't work!!!
			success: function(data, status, xhr) {
				var out = (data && typeof data === 'object') ? JSON.stringify(data) : data;
				alert("OK!" + out);
				console.log(out);
			},
			error: function (xhr, ajaxOptions, thrownError) {
				alert("KO!!!!! - status: " + xhr.status + ", error: " + thrownError);
			},
			beforeSend: function(request) { // Set JWT header
				request.setRequestHeader('Authorization', 'Bearer ' + store.JWT);
			 } 
		});
		
	});

MichaelG
User
Posts: 1111

Post by MichaelG »

Make sure that you have enabled extended search for the field. You can then filter by querystring (i.e. ?field=xxx)


Andros
User
Posts: 111

Post by Andros »

Thanks. But I don't understand: there is a complete syntax? what about different comparison operators? The docs don't say much about this.


MichaelG
User
Posts: 1111

Post by MichaelG »

Enable extended search and perform the search on the list page to see the querystring parameters involved.


Post Reply