How to send multiple fields in the "word_similarity" PostgreSQL function - postgresql

[See image here]
I have two fields in the table respectively name and note. Now I want to search words using the name and note both simultaneously. Here I have called the CriteriaBuilder function using the "word_similarity" key (I guess this 'word_similarity' is one internal function that works). Here you can see I passed the name field and got the result successfully.
But I want to search both fields simultaneously.
So how do I pass both fields (name and note) and get a search result? I am a new learner.
I would greatly appreciate all your suggestions.
I have tried to send multiple words like
cb.function("word_similarity", Double::class.java, root.get("name"), root.get("note"), cb.literal(s))
But not working.

Related

Return a value based on a function in placeholder in oracle Apex

Sorry if this is a "stupid" question, but I am new to Apex.
I made 2 processes on the create button: one is to insert into the department table and the other one to send an email with some info, among them the department too.
I made an email template and I want to display the department name, not the id which is inserted into the table. So I thought, that maybe I can do that with a function, like in the picture attached(get_department_by_id - returns the name of a department).
[example][1]
[1]: https://i.stack.imgur.com/bjBag.png
The help function in the builder usually gives enough info. Here is the help for "Placeholder values"
So only Application, Page Items and System Variables are allowed.
Note: There are multiple places in APEX where you can pass a number of arguments (links, branches, etc) but nowhere the use of functions is allowed.
This is how it worked for me.
I created a computation, with the computation of type "Expression" with source get_department_by_id(:P7_ID_DEPARTMENT) and Condition Type "Request = Expresion 1" with source the name of the button(ex.create).
Thank you Koen Lostrie for the guidance!

Query script not run in suggest box

In AppMaker, one my datasources has a simple query script associated with, because I need a filter everytime the datasource is requested. I'm talking about a normal SQL based datasource (not calculated).
Is it normal than this query script is not used when the datasource is used in a Suggest box ? Because it breaks my app (the user is able via the suggest box to select items he's not even supposed to see).
Thanks for your help
The options for a suggest field text box can either be provided explicitly, by binding to the options property, or by specifying a database query on a model using a startsWith filter on a field. You can set the model and field for the latter option below.
So you can try to create calculated model with server script starts with
var name = query.filters.name.startsWith;
name is field of model

Microsoft Access - Creating a form which looks up data between 2 dates

For my College assignment, I have to create a database in Access, I have done 99% of my database, apart from this section which I'm stuck on.
In my DB, I have a tickets table, which contains records on order information and a field containing a date. For my assignment, I have to create a Form which reads from a Query.
For example, in my Form i have already created i have 2 Combo boxes with the dates already pulled from the Query. I need to be able to drop down one of the boxes and input 1 date, and then drop down the other box and select a different date, press a button and it generate me a Report.
The part I am asking for help on is the expression which is used to look up the data inside the Query. I tried using this expression, which Access said was too complicated.
[Forms]![frmOrdersBetweenTwoDates]![Combo33] And [Forms]![frmOrdersBetweenTwoDates]![Combo36]
My full SQL query is:
SELECT tblTickets.CustomerID, tblCustomers.FullName, tblCustomers.AddressLine1, tblTickets.OrderNumber, tblTickets.OrderDate
FROM tblCustomers INNER JOIN tblTickets ON tblCustomers.[CustomerID] = tblTickets.[CustomerID]
WHERE ((("WHERE [OrderDate]") Between [Forms]![frmOrdersBetweenTwoDates]![Combo52] And [Forms]![frmOrdersBetweenTwoDates]![Combo54]));
My expression/query now returns the report, but there is no data inside the report. How could i fix this?
Cheers.
Should post the complete query statement. Expect the filter clause should be like:
WHERE [date fieldname] BETWEEN [Forms]![frmOrdersBetweenTwoDates]![Combo33] AND [Forms]![frmOrdersBetweenTwoDates]![Combo36]
However, I don't use dynamic parameterized queries. I prefer to use the WHERE argument of OpenReport (same for OpenForm), in VBA:
DoCmd.OpenReport "report name", , , "[date fieldname] BETWEEN #" & Me.Combo33 & "# AND #" & Me.Combo36 & "#"

How do I search though related tables in access and have the results displayed in a list box

I have created a form that searches through a table, following the instructions of John Big Booty, as can be seen here: https://access-programmers.co.uk/for...d.php?t=188663. The search form has a list box that has a query run whenever a text box is changed which allows me to search fields in one table but how do I adjust it to allow me to find related records stored in a second table. The database stores widow information and they are looked after by legatees.
The query has the following code in the criteria for each field you want to search Like "" & [forms]![FRM_SearchMulti]![SrchText] & "".
Each legatee is responsible for looking after multiple widows and any widow can be assigned to any legatee but any widow can only one legatee when she is assigned to one.
The search form is called FRM_SearchMulti and it searches through the widow table as I type. I want it so that you can type in a legatee and it will display the widows that have been assigned to that legatee typed in the search box. I seem to have hit a road block and everything I try doesn’t seem to work.
I have uploaded a version of the db with a lot of the information deleted, for privacy reasons, so if it is possible, could you describe to me how to do it and I will update the file with all the information in it please?
Any help would be greatly appreciated.
Thanks,
Dave

Writing a query with ORMLite

How can I write a query with ormlite instead of using .create or any other thing like that? Can you please show me how for this simple example :
SELECT name FROM client
EDIT since I can't answer myself :
I guess I had to search a little more , anyway I found how to do it with the QueryBuilder like this :
newDao.query(newDao.queryBuilder().where.eq("name",valueofname)
If someone knows how to write the full query that would be great , otherwise , I'll stick with this solution
How can I write a query with ormlite instead of using .create or any other thing like that?
Goodness, there are tons of documentation about how to do this on the ORMLite site. Here's the section on the query builder.
I'm not sure what you mean by "full query" but your example will work with some tweaks:
List<...> results = newDao.queryBuilder().where().eq("name",valueofname).query();
It does not make sense to just return the name since the Dao hierarchy is designed to return the specific Client object. If you just want the name the you can specify the name column only to return:
... clientDao.queryBuilder().selectColumns("name").where()...
That will return a list of Client objects with just the name field (and the id field if it exists) extracted from the database.
If you just want the name strings then you can use the RawResults feature.