How to store object on URL query string - reactjs

I am developing a generic search component on React that puts it's filters, current page and some other params on the URL query string (after the ?).
I currently use the URLSearchParams to transform the query string to js objects and back to query string, as the react-router-v4 expects
The point is that I need to store an Object within the query string, so I can differentiate the search filter (that can have multiple fields) from other params.
I see that I can transform a object to JSON, and store everything on a filter param, or I could store the object using dot notation (?filter.name=foo&filter.tag=bar) or even a square brackets notation (?filter[name]=foo&filter[tag]=bar) and treat them accordingly when reading them from the url.
I am tending to choose the JSON notation, but Is there any problems with this approach? Should I know beforehand any limitations? Is there a better way to do it?

Related

TanStack Table (React-Table) | How to convert the column filter state into the format that the backend is excepting?

I'm trying to implement server-side column filtering for a table in my React app, but I'm having trouble converting the "ColumnFiltersState" object that I'm using on the frontend into the format that the backend (which uses the "nestjs-paginate" library) is expecting. The "ColumnFiltersState" object contains a "value" field that can be of type "unknown" and I'm not sure how to handle it. I have a couple of possible solutions in mind:
One solution could be to use the "filterFn" property for each column, and pass in the filter operator that the backend is expecting (e.g. '$eq', '$gt', etc.) along with the value.
Another approach would be to define a separate mapping function that maps the "ColumnFiltersState" object into the format that the backend is expecting, using the appropriate filter operator and value for each column, but then how we would know witch operator to use, maybe add custom meta prop to the coulmnDef.
Can anyone provide some guidance on how to correctly map the column filters for the backend, and which solution would be the best approach? I would really appreciate any feedback or advice on the best approach, and even better if there is an example code to help me understand the solution better.

Get parameter from a given URL (not the calling) in Logic App

I have an URI as a string which I get out of a Json in my Logic App.
How can I access any of the query items of the uri?
Inside the For Each which loops through the uri string list, i tried the following expression to get the query parameter filename, but it did not work:
items('For_each_2')['queries']['filename']
This returns 'The template language expression 'items('For_each_2')['queries']['filename']' cannot be evaluated because property 'queries' cannot be selected'.
There is a URI parsing functions in logic app to query property from URI, suppose you want is uriQuery, however it returns the whole after ?. It will be like below.
And if you want to query a specific property, you should pass them with the logic app trigger URL. It provides triggerOutputs()['queries'] property to get the queries, and this will return a json object, it will allow you to query specific parameter.
This is a sample:
https://xyz.logic.azure.com:443/workflows/id/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=code&test=123&test2=345
Then should be able to use triggerOutputs()['queries']['test'] to query.

Angular 2+ mongoose, let on array doesn't work due to ID object

I am trying to do a let on an array of data that is requested from a mongoose server.
This works if I don't return the ID object with the rest of the Json data.
However I want to add the ID data as params to routernavigate to another component.
Is there an easy way of receiving the id as a string rather then an object?
You can use following to stringify your object data
JSON.parse(JSON.stringify(''));//use your result object as parameters
as a example JSON.parse(JSON.stringify(result['_id']));

Document Converstion for PDF form (eg. w2/1040/etc) as key/values instead of a single string based on font information

Trying to use the Document Conversion service to capture the json key/value pairs for the pdf documents such as (w2/1040/etc forms.)
Content of such forms in json response are coming as part of the "text" under the "content". Missing the form data, but mostly rendering the form labels as a single string.
I would like to know if there is anyway to capture the form data for the pdf (w2/1040/etc) as key / values in json instead of a single string?
Thanks.
Unfortunately, the Document Conversion Service currently does not support forms in PDFs. At most, it may recognize some of the forms as tables, but not as key/value pairs.
If it recognizes a form as a table, you still would need to do some non-trivial post-processing to map it to key/value pairs.

angularjs - storing table view filters in url

I have a table view with a form above it for doing advanced search (text fields, date ranges, drop down lists etc.)
I am trying to store this state in the URL using `$location.search('filters', angular.toJson($scope.filters)); but was wondering if there is a better way.
The reason I want to make use of the URL is so people can share links to filtered data.
This is a perfectly valid use case for $location.search, but you don't need to do an angular.toJson. $location.search accepts an object as its parameter and will automatically convert it into an encoded query string before applying it to the URL.

Resources