How to Get an Item From a Data Collection with WiX Code | WiX Data API - .get() Method | Velo
ฝัง
- เผยแพร่เมื่อ 1 ต.ค. 2024
- In this series I walk you through the long await WiX Data API!
The WiX Data API allows you to interact with data collections using code (Velo). With just a few lines of code you can get, add, remove or update items in your collection. You can also do more complex things such as querying a collection based on a certain field - value pair, using hooks to take action before or after a collection is changed and more!
In this video I talk about the .get() method with lets you retrieve an item from a collection using the item id.
See the full documentation here:
www.wix.com/ve...
New to Velo? Try my new Velo for Beginners course:
www.udemy.com/...
Have an idea for a video? suggest it here:
www.thewixwiz....
Have questions? Join the discussion:
www.thewixwiz....
Want to have joint coding session? Book one now:
www.thewixwiz....
Have questions? Need some magic done on your website ASAP?
www.thewixwiz....
Follow along on Twitter @thewixwiz
Facebook page: / thewixwiz
Facebook community: / thewixwiz
👋👋New to Velo? Check out my new Beginners course now on Udemy! ➡➡ www.udemy.com/course/velo-for-beginners/
This code didnt work for me. I'm not sure why. I am trying to get a text box to display a specific item's title
Got this code bacl: Oj-vej! This event is not supported by logger Failed to evaluate expression: Error: Syntax error. Unexpected whitespace near: myCollection = "Adaptations
const myId = "7ad44c44-e1b6-4ac6-9ea6-3de3f8b929de"
Hi, it's hard to help without seeing your code...
You are welcome to post to the forum or schedule a consultation to receive assistance :)
www.thewixwiz.com
@@thewixwiz Thank you! Was already planning on booking you in a few weeks!
Does anyone know if you can do this with excel or csv files
Do you mean retrieving the data from the files and displaying them on your site?
They would have to be hosted online in google sheets etc. You can also import CSVs to your Wix Collections.
Great thanks.
seems absolutely useless
Things aren't always what they seem
I've been trying to connect a dropdown to a collection only through wix code so I can change the default value on click. How do I do that...? I've been searching forever for this solution. Every time I cross someone who has ".option" or ".setOption" in their code, mine won't take that. Losing my mind here. It's such a simple thing, but.......I can't figure it out.
:(
Have you checked out the API documentation?
www.wix.com/velo/reference/$w/dropdown/options
can you please do a post request to create a member using only email?
You could expose an endpoint using http-functions or look into the REST APIs if you're building an app for Wix.
how can i get the ID of an item to vary depending on the item displayed on the page (dynamic page)?
You can use $w("#dynamicDataset").getCurrentItem()
@@thewixwiz i want to use the values in database collection for the values in wixpay createpaymentforproduct function. i tried this snippet but it doesn’t all $w in as a value in back end jsw file any ideas how to get this to work?
How can I look for someone for lets say a certain name in the CMS like if name is the same blank
What do you mean "the same blank"?
I want to get products collection created by stores app of wix.
support.wix.com/en/article/velo-wix-stores-products-collection-fields
Hi tested this, and noticed it works for items in the collection are the "visible" but it produces a null value when the item is "hidden." the collection I'm testing this with is tied to dynamic pages. Is there an adjustment we can make to include hidden items in the function?
Hi, one option would be to use a boolean field to control if items are hidden on your site or not and employ custom logic where you are querying and displaying collection items.
@@thewixwiz how would you employ custom logic with a get or query function?
hi, i have one question how can i get data with someother field instead of _id?
For that you will need to use WiX data query.
would it be possible to do the same? but instead of using the id that wix provides, i create a separate field and make it primary called "userID"?
With .get() you can only use the WiX ID. To use any other field take a look at the .query() tutorial.
@@thewixwiz understood! thanks a ton for your quick reply! subscribed!
I'm getting a null value when trying to search using email. How can I correct this?
You may be looking for WiX data Query.
@@thewixwiz thanks
What language name called use in wix
Not sure I understand 😅
Can't get this to work. There are missing steps to setting up the page which the vide shows as set up with a name field but does not explain. Is it a dynamic page? Does the collection need to be connected? How?....
Hi there, the video assumes you have basic knowledge of WiX elements and collections. The page in this demonstration is a regular page and the interaction with the collection is done using code.
@@thewixwiz sorry to say this...but it doesnt seem to work...has wix made any update conflicting this?
@@thewixwiz im sooo sorry wix wiz...i just figured out it really works...thankssss soooo sooo much
The code only runs in preview mode but doesnt run on the actual website....can i get some tips on this...what actually is wrong...please help sir
@@emmanuelyevu7459 Please post your question to the forum along with code snippets, error messages, and screenshots if necessary. eitanwaxman.com/forum
hi how do Display a Different image every hour from a Collection data base on my home page which is a regular page not a dynamic page ive set up collection with time in the field and connected it to data set but nothing seems to happen please help me my friend as something i thought would be really easy to do is driving me mad
Hi, thanks for your question. You are welcome to join the livestream today and ask about it
th-cam.com/users/live4uPX9GB3n7c?feature=share