Preprocess GET Filter values


#1

Hello,

I am creating a simple script to grab records from a database using a filter parameter n. I would like to find out how to pre-process a GET filter parameter value such that if n=ABC, the actual request sent will be n=XYZ.

This is because in my table the value of ABC does not exist, only XYZ. So the original request will result in no results found.

I have tried using event.request.payload.resource and event.request.query.n to no avail - I’ve been getting “undefined” errors for hours.

What is the way to grab the value of a filter parameter and change it in pre-process scripts?

Any help will be greatly appreciated!

Cheers
Glen


#2

Hi,

take a look at this: http://wiki.dreamfactory.com/DreamFactory/Tutorials/V8_custom_scripting_service

Maybe the event.request.parameters; have the filter value.


#3

Hi @kimpatro,

I managed to grab the filter parameters and modify them, but am unable to get it processed by the server.

I tried using event.request.content_changed = true; but it didn’t seem to work.

How do we feed the parameters back to the server in order for it to be processed?

Glen