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

ความคิดเห็น • 44

  • @thewixwiz
    @thewixwiz  11 หลายเดือนก่อน

    👋👋New to Velo? Check out my new Beginners course now on Udemy! ➡➡ www.udemy.com/course/velo-for-beginners/

  • @TonkaJahari
    @TonkaJahari 2 หลายเดือนก่อน

    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

    • @TonkaJahari
      @TonkaJahari 2 หลายเดือนก่อน

      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"

    • @thewixwiz
      @thewixwiz  2 หลายเดือนก่อน +1

      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

    • @TonkaJahari
      @TonkaJahari 2 หลายเดือนก่อน

      @@thewixwiz Thank you! Was already planning on booking you in a few weeks!

  • @james3440
    @james3440 2 หลายเดือนก่อน

    Does anyone know if you can do this with excel or csv files

    • @thewixwiz
      @thewixwiz  2 หลายเดือนก่อน

      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.

    • @james3440
      @james3440 หลายเดือนก่อน

      Great thanks.

  • @Temp-s7l
    @Temp-s7l 25 วันที่ผ่านมา

    seems absolutely useless

    • @thewixwiz
      @thewixwiz  21 วันที่ผ่านมา

      Things aren't always what they seem

  • @SennaCrow
    @SennaCrow ปีที่แล้ว

    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.
    :(

    • @thewixwiz
      @thewixwiz  ปีที่แล้ว

      Have you checked out the API documentation?
      www.wix.com/velo/reference/$w/dropdown/options

  • @NODNyNy
    @NODNyNy 2 หลายเดือนก่อน

    can you please do a post request to create a member using only email?

    • @thewixwiz
      @thewixwiz  2 หลายเดือนก่อน

      You could expose an endpoint using http-functions or look into the REST APIs if you're building an app for Wix.

  • @RudeRumourPS5
    @RudeRumourPS5 ปีที่แล้ว +1

    how can i get the ID of an item to vary depending on the item displayed on the page (dynamic page)?

    • @thewixwiz
      @thewixwiz  ปีที่แล้ว +1

      You can use $w("#dynamicDataset").getCurrentItem()

    • @RudeRumourPS5
      @RudeRumourPS5 ปีที่แล้ว

      @@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?

  • @asega27
    @asega27 5 หลายเดือนก่อน

    How can I look for someone for lets say a certain name in the CMS like if name is the same blank

    • @thewixwiz
      @thewixwiz  5 หลายเดือนก่อน

      What do you mean "the same blank"?

  • @arkthespark
    @arkthespark ปีที่แล้ว

    I want to get products collection created by stores app of wix.

    • @thewixwiz
      @thewixwiz  ปีที่แล้ว

      support.wix.com/en/article/velo-wix-stores-products-collection-fields

  • @joannkol5087
    @joannkol5087 6 หลายเดือนก่อน

    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?

    • @thewixwiz
      @thewixwiz  6 หลายเดือนก่อน +1

      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.

    • @joannkol5087
      @joannkol5087 6 หลายเดือนก่อน

      @@thewixwiz how would you employ custom logic with a get or query function?

  • @ifampk
    @ifampk ปีที่แล้ว

    hi, i have one question how can i get data with someother field instead of _id?

    • @thewixwiz
      @thewixwiz  ปีที่แล้ว

      For that you will need to use WiX data query.

  • @walkthroughonthego2476
    @walkthroughonthego2476 11 หลายเดือนก่อน

    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"?

    • @thewixwiz
      @thewixwiz  11 หลายเดือนก่อน

      With .get() you can only use the WiX ID. To use any other field take a look at the .query() tutorial.

    • @walkthroughonthego2476
      @walkthroughonthego2476 11 หลายเดือนก่อน

      @@thewixwiz understood! thanks a ton for your quick reply! subscribed!

  • @FubuDon
    @FubuDon ปีที่แล้ว

    I'm getting a null value when trying to search using email. How can I correct this?

    • @thewixwiz
      @thewixwiz  ปีที่แล้ว

      You may be looking for WiX data Query.

    • @FubuDon
      @FubuDon ปีที่แล้ว

      @@thewixwiz thanks

  • @PoojaSinha-ir3rw
    @PoojaSinha-ir3rw ปีที่แล้ว

    What language name called use in wix

    • @thewixwiz
      @thewixwiz  ปีที่แล้ว

      Not sure I understand 😅

  • @RaymondWarren-qw1sq
    @RaymondWarren-qw1sq ปีที่แล้ว

    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?....

    • @thewixwiz
      @thewixwiz  ปีที่แล้ว +1

      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.

    • @emmanuelyevu7459
      @emmanuelyevu7459 ปีที่แล้ว

      @@thewixwiz sorry to say this...but it doesnt seem to work...has wix made any update conflicting this?

    • @emmanuelyevu7459
      @emmanuelyevu7459 ปีที่แล้ว +1

      @@thewixwiz im sooo sorry wix wiz...i just figured out it really works...thankssss soooo sooo much

    • @emmanuelyevu7459
      @emmanuelyevu7459 ปีที่แล้ว +1

      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

    • @thewixwiz
      @thewixwiz  ปีที่แล้ว +1

      @@emmanuelyevu7459 Please post your question to the forum along with code snippets, error messages, and screenshots if necessary. eitanwaxman.com/forum

  • @slypaul911
    @slypaul911 ปีที่แล้ว

    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

    • @thewixwiz
      @thewixwiz  ปีที่แล้ว

      Hi, thanks for your question. You are welcome to join the livestream today and ask about it
      th-cam.com/users/live4uPX9GB3n7c?feature=share