Confused about referencing repeated items

I have a repeater called current.
image

When I run the app, the object(title) of repeater is visible (even tho is says undefined in the formula).

But, when I attempt to toast/access the same object, using the same formula, it produces an undefined. How come? The toast message doesn’t appear.

Hello @CoolBeans ,

Are you able to share the structure of your object? I’m wondering if simply the capital T in your LOOKUP is variable “Title” is causing the issue. But seeing your object may help us help you.

Cheers

Sure here it is.

Okay that looks fine.

if you’re in a repeat, and within the context of the repeated item, you don’t need to use the LOOKUP, since the context of current is already in your scope.

Yes!! That did the trick. So what’s working for me is

  1. Using the LOOKUP(PICK_ITEM(appVars.GetManyVideosItems, repeatedInfo.current.index), “Title”) on my view component
  2. Using the shorthand, current.title within my logic flow.

Excellent. However, is there a reason that you’re using formulas at all? The platform allows you more direct access to current




I’ve tried that but for some reason I dont see those repeated options(title,name etc). Maybe I am doing something wrong with how I am retrieving the repeated data? Once the page loads, I do the following
image

  1. Call the data resource

  2. Map the data from the call of the data resource

Ah, when creating a data variable, make sure your API schema for the response is set.

The reason I have “Title”, “Data_added”, etc available is because I defined the object as a page variable, which is the same as your app variable, then I populate that page variable the exact same way that you are from a custom js as a stub for the call.

https://docs.appgyver.com/app-logic/variables/app-state#data-variables

Yes I believe I set the data variables schema as such:

Can I see your JS code?

Perfect. Now on the page that you’re calling that data and placing it in the app variable, you need to make sure that schema makes it through, too. I’m wondering if you mean to be adding a “data” variable to your page instead of an “app” variable.

Here’s my JS, but it’s immaterial to the labels, i’m just mocking the data call.

What you’re more interested in is getting the local page to be object-schema aware and you can do that by adding a “data” variable to the page that represents (from a dropdown) the API call, and binding your repeat to that.

Here’s what my page variable looks like:

So are you manually adding in the fields for your GetManyVideos Page variable? My API returns about 30 fields.

That’s correct, I just created a stub of yours.

Let’s make sure we’re on the same page:

  1. In your variables scope of the page you’re working on, you’ve selected to add a “data” variable?

See my employees one here and the logic it runs to populate that object on page load so that I can bind to the data variable in my lists.

Ahh I see. I have to manually add in the fields.

This is what I have for my data variable

If you already have the API setup (which I believe you do), you simply need to click on “add data variable” and select your api “GetAllThemVids” and it will pull in the source schema for you to be able to bind to.

@CoolBeans I noticed something in what you posted that I didn’t notice earlier. It might be nothing.

You’re showing us a “POST” api call in your config but in your data flow you’re showing us a GET. Have you configured your API for the GET and its corresponding returned schema? I imagine you have and it is immaterial, but wanted to check.

It will be material if you, like some of my APIs, require a POST even for lookups. In that case it’s a little different flow to get the data to your frontend variable… i.e. you’ll need to define the full schema of the variable you want to fill with the POST instead of using the backend sourced schema.

Hello Lance, I’ve tried that but doesnt seem to work for me. By any chance are you willing to log into my machine via teamviewer for about an hour or 2? I can pay hourly. I’ve been beating my head on what seems to be simple tasks. And in addition one second a component works as it should then suddenly it stops working. #frustrating