Total newbie questions

I just started with Appgyver, and I’m trying to follow the tutorials.
In the data section - “listing data” - if I follow the instructions step by step - and I create a list, whenever I enter another entry - the list doesn’t auto update like it does in the video. (I did try to set the “refresh data” to true, and the refresh rate to 5000, although it is not in the tutorial, and still).

Also - the “updating records” tutorial – even though I did everything step-by-step – it didn’t pass me. :frowning:

last thing (for now) and I don’t quite know how to phrase the question – I want a user to enter an input, and to check that input with the existing db to see there’s no identical record. I tried finding a suitable formula like “is_in_array”, but didn’t manage.

thank you!

please share some images to get a better understanding of the problem, also what are you using as a backend?

As for the the last question its possible, but you need to make everything else work first.

Thank you for replying.
I am just copying the tutorial videos you get in the main editor (under “data”, videos 2 and 4).
I am not using anything external as my backend. The data source is a local one.

thank you.

Well, I started another project, done exactly the same steps, and now it works :frowning:

Anyhow – how do I check for duplicates in a table?
I have a local database called “ingredients” that has an ID and Name.
I have a data variable called “newIngredient”

I have an input field that has its value pointing to newIngredient
and a submit button that creates new record.

I want to verify that the new input doesn’t already exist in the list.

Can someone please help?
many thanks.

you could try using an if with the function IS_IN_ARRAY_BY_KEY or IS_IN_ARRAY
depending on how the data is structured

Thank you for replying.

if I understand what you’re saying, my data is structured thus:

I have a local database called “ingredients” that has an ID and Name.
I have a data variable called “newIngredient”
I have an input field that has its value pointing to newIngredient
and a submit button that creates new record.

let’s say I want to use the IS_IN_ARRAY function… how do I do it?
It wants two parameters – (1) list, and (2) item to check.
I suppose the item to check is the new data entry – newIngredient,
but what is the list?

what am I missing here?

so from this i understand its an object so i would use is in array by key

i guess you use a submit button and there should be the if function like this

ignore the red errors in your case they should not exist

so I try to enter this:

IS_IN_ARRAY_BY_KEY("", “name”, data.NewIngredient.Name)

But I don’t know what to enter in the list parameter.

the “data.newIngredient” is an object, so I get an error message “object type is not assignable to list type”

I am sure I am missing something really basic here, I just don’t know what.

when i said object, i meant list of objects… and so thats the list you should put in the function.
more specifically, this

is the input of the user
and the list, is the list of objects that you want to see if it already has the ingredient that the user inputs
for better understanding, if the problem doesnt get solved please share some images.

here goes:
picture 1 - shows the on-device data resource.

picture 2 - shows the data variable configuration

picture 3 is the logic for the submit button

Right now everything works – meaning - I enter something, it updates the table below.
I want to make sure there are no duplicates before saving it.
that is the “if condition” on the bottom there (that is not connected)

in the if condition I try entering the formula we talked about before, but don’t know what to put in the “list” parameter.

Thank you so much for your assistance. I really appreciate it!

the problem, is in the on device storage(picture1), the way you need to define it is as bellow
list of object with two properties
(in the first image it says navigation, thats wrong, thats probably a bug, you should choose list even though it will display as navigation)

As you said, everything works, but the data is not a list of objects its just one object

if it doesnt work as intended, maybe the cause is the thing that says navigation instead of list.
i made this post. after you test it, you can comment on that post about your results

Whenever I try to create/configure the on-device storage data resource, I get this:

As you see, there’s a default “id” which is a text type.

So I added a new property, with type “list”

under “list item type” - I chose Object

so now - two things happen –
(1) I still can’t find something to put in the formula in the “list” parameter
here I show that the only place the data source “IngredientsList” shows is under schemas.resources.IngredientsList – and it is not a list… :frowning:

the other data.NewIngredient.List shown are also not lists.

(2) in the list component - under configuration -

there is only ID to enter the list

  1. as for the id you cant delete it so leave it there. the other configuration for the list and object is correct
  2. then you need to go in the page that you want the data to be used and create a data connection there (i dont know if you have done this step) like bellow and then you will be able to access the list from the function

one more thing to take a look is at the right you need to choose the collection option(its also the default)
if you still cant access the data you will need to ask help from someone like mevi
because i did it and it works

It doesn’t work for me –
if I set up the data source as suggested, I can’t use it for the input field /or/ the list component. :frowning:
I get this:

(first one is a data variable with “new data record” selected, the 2nd one is the one with “collection of data records” selected. Both are incompatible.

I also have the same issue described above with not being able to define the list properly, because it only gives the ID when mapping the fields.

i dont understand with what you are trying to bind the data variable, but maybe @Mevi can help here?

Hello there, I tried to recreate your issue and solve it. So you have configured the basic list component right, it refreshes as supposed to do etc. But You want to check wether an ingredient is in the list already?
For this you have to have a data variable that is the collection of the ingredients. When you have it, you can use this variable as a “list”. You want to check if the input’s value that is in your case also bind to a data variable. You want to do this check after clicking the button. I may have used different names, but you can adjust it to your needs. (also I never use capital letters in properties because I am never sure how they are interpreted so let’s stick to the following now).

So here is the data resource setup:

Next data variables:

Logic flow of the button tap event:

Here in the IF condition we set the value to the following formula:

IF(IS_IN_ARRAY_BY_KEY(data.ingredients_list, "name",,true,false)

This checks wether an ingredient has already been added. If true, it will show an alert with the following text:

`" has already been added to the list of ingredients!"` 

The rest is self-explanatory.

But only if your user will be careful enough not to type e.g. “sugar” and “Sugar” since these are different in the capital “S”. Because the two will be regarded as a different value. So the next part is optional but a good to know paragraph:
If you want to avoid lowercase and uppercase issues I suggest changing up the Create record flow function to the following:

Where the right formula is the following:

LOWERCASE(LOOKUP(source.object, "name"))

This will store the lowercase version of the property which is more sure to provide the best check at the IF formula. Also to double check yourself or the user you could change the IF formula to the following as well:

IF(IS_IN_ARRAY_BY_KEY(data.ingredients_list, "name", LOWERCASE(,true,false)

So that now it is really sure that there will be no duplicate ingredients in the list.

*Last side-note: I would use a simple container with repeated data of data.ingredients_list for best design and layout options. Thus you have more flexibility then in the basic list component. But that is I guess still to come in Your journey on this platform. Hope you will find it useful as well.

Best wishes


Thank you so much!
It works. I’m still trying to figure out why it works, but I think I begin to understand.

Again thank you, @Mihaly_Toth and @Dimos_Vamvourellis for your help! much appreciated!