Hi Community,
We have a MySQL DB connected via Apache Sling Connection Pooled DataSource.
It's working fine for getting, inserting and updating data through the forms.
We need now to implement a search on a column in a table in the db from a form, but I found out that the default data model get service cannot be modified with a custom SQL statement (for example "SELECT * FROM Table WHERE Column LIKE (?)") in the form data model editor.
Is there a way to create a new service with a custom SQL statement? Or is there a way to use custom SQL statements with form data model?
thanks in advance
Solved! Go to Solution.
Views
Replies
Total Likes
@lollo901 it doesn't work on a pattern basis or partial string, the whole string/value needs to match the DB value for the data to be returned
Views
Replies
Total Likes
I write the exact statement that I would like to use in order to retrieve my data
SELECT *
FROM users
WHERE firstname LIKE '%namepart%'
How can i pass the param '%namepart%' in order to retrieve all records that contains my search?
I try to explain better
If I have a firstname record that is "John Fitzgerald", if the user just type "John", the service should retrieve all the entries that have John in the firstname column. At the moment the service seems to be just WHERE firstname LIKE "John", but i need to perform WHERE firstname LIKE "%John%"
How do I pass a param with "%"? Is it possible?
Views
Replies
Total Likes
@lollo901 it doesn't work on a pattern basis or partial string, the whole string/value needs to match the DB value for the data to be returned
Views
Replies
Total Likes
Ok, so I cannot customize the SQL statement in FDM. Thank you
Views
Replies
Total Likes
You can pass the argument in read service to query the required data from DB.
Views
Likes
Replies