Hi ziv,
I’m trying to develop a complex recipe - recommendation - inventory application.
I can elaborate the details in private.
For that, I want to have many tables with different relationship to get the complexity I’m looking for.
Take a look at our coming soon page.
we are working or adding references between collections and allowing for “joining” two or more collections in a single query.
Me again… hahaha
I know you just gave me exactly what I asked for, but is it possible to achieve this using Sorts and Filters instead of query? The reason I ask is because I have set sort buttons for my filter buttons, that won’t work with queries. So say a search result returns a large amount items, and they want to sort old to new, new to old, a to z or z to a, they can’t do this at the moment, even though I have buttons there for it.
So I’m thinking of doing one of these options based on your answer. Listed from Most to Least preferred.
Change search results to filter instead of query.
or
It WORKS!!! I followed Nayeli’s video and it worked like a charm! The only hiccup I had was that in my search results table, the results are showing the RichText code as well as the text, instead of just the text. (see screenshot) I may just be missing something simple, but obviously, I would like just the text to appear. Do I need two identical columns in my database with identical information - one with RichText formatting for the Dynamic Page and one unformatted for tables (please say no, please say no . . . ).
Also, this particular search is always going to return just one record. Is it possible to send the results straight to the dynamic page or to regular text fields right there on the search page instead of to a results table so I could make it look pretty?
Thank you so much to everyone on the Wix Code team for being so patient with us newbie coders and to the other beta team members for sharing our work!! Thank you, thank you, thank you!!
what prevents you from adding a sorting operation to the query?
I have no idea, but my filter/sort buttons stop working entirely once a query has been submitted.
I have sort and filter buttons using this code
Filter Button(s)
// ... filter videos to TAG
export function TAGButton_onClick(event) {
console.log("filtering videos to TAG");
$w("#videos").setFilter( wixData.Filter().contains('tags', 'TAG') )
.catch( (error) => {
let errorMsg = error.message;
let code = error.code;
} );
}
Sort Buttons
export function OldNewButton_onClick(event) {
console.log("Sorted Videos Oldest To New");
session.setItem("sortOldNewEnabled", "value");
$w("#myCollection").setSort( wixData.sort()
.ascending("created")
)
.catch( (error) => {
let errorMsg = error.message;
let code = error.code;
} );
}
export function NewOldButton_onClick(event) {
console.log("Sorted Videos Newest To Old");
session.setItem("sortNewOldEnabled", "true");
$w("#myCollection").setSort( wixData.sort()
.descending("created")
)
.catch( (error) => {
let errorMsg = error.message;
let code = error.code;
} );
}
export function ZAButton_onClick(event) {
console.log("Sorted Videos Z To A");
session.setItem("sortZAEnabled", "true");
$w("#myCollection").setSort( wixData.sort()
.descending("title")
)
.catch( (error) => {
let errorMsg = error.message;
let code = error.code;
} );
}
export function AZButton_onClick(event) {
console.log("Sorted Videos A To Z");
session.setItem("sortAZEnabled", "true");
$w("#myCollection").setSort( wixData.sort()
.ascending("title")
)
.catch( (error) => {
let errorMsg = error.message;
let code = error.code;
} );
}
The query is default sorted to .descending(“created”). What happens is I run a search and the results appear as they should. But when I click the sort buttons connected to the code above. Say I click the sort Z - A, or the Old - New button, they don’t sort the query results, they do, nothing.
All my filter buttons also break, so I think need a way to turn the search method into a dataset .contains filter instead of a query.
Otherwise I need a way to clear/remove the query before filtering when clicking the filter buttons and a way to hide the sort buttons when a query is active.
Thank you so much for this awesome discussion. I have two questions:
I want to use the search feature for my database, allowing users to search the ‘title’ column from my database. However, instead of showing results in a table, I just want the ‘on click’ to take the users to a dynamic page with the value they insert. For example: If someone types “neurons” in the textbox and hit submit, I want them to be taken to the page R-Suri.com/key-terms/neurons. How can I make this happen?
Is there a way to allow users to hit the ‘enter’ key in addition to clicking on the submit button. I was looking at duplicating the same code as the one I would use for submit button, but with the ‘onKeyPress’ command. Thoughts?
I have a dynamic page, which displayed data extracted from database, based on user input, perfectly (thanks to Nayeli’s video) ! Now, this database also has a document field, how do I connect this document to the first column of the data fetched from the databse, so that it can be downloaded when clicked on first column?
The table element here is not connected with the database and is accessed and displayed through code only, as explained in varoius examples in forum.
Following is the code am using
import wixData from ‘wix-data’;
export function partySearch_onclick(event) {
let searchValue = $w(‘#partyInput’).value;
Column - Party Name; Type - Text; Field key - title
Column - Court; Type - Text
Column - Referrence; Type - Text
Column - Date; Type - Text
Column - Citation; Type - Text
Column - Held; Type - Text
Column - Document; Type - Document; Field key - document
With the ‘title’ Field Key, I need the ‘document’ Field Key connected.
Is it possible to search from two fields? That is, is it possible to search from the Title field and the description field that I have at the same time using a OR condition? What if I want to search the entire dynamic page for the search term instead of just one field? Is all these possible using wix code? Thanks