Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

How do I make an image visible/not visible for each record in a list based on a second collection?

Hi Gabriel,

[quote:]
The actual result is alerts 1,2,3,4,a.
[/quote]

  • this not a bug.
    This is how it works, you are running the service and it's working asynchronously (or let's say parallel) and the program is keep on working.

    About your question: we will think how to make it easier and we will update.

Oleg Danchenkov
Posts: 0
Joined: Tue Apr 30, 2013 5:51 pm

How do I make an image visible/not visible for each record in a list based on a second collection?

"Using include would limit the record to only those that are in both collections." - No
"I need to be able do the same as an OUTER JOIN type function in SQL" - you can do it in appery.io database. Try it. See screenshots for explanation.
Image
Image
Image

Gabriel Bizcarra
Posts: 0
Joined: Sun Dec 22, 2013 1:02 am

How do I make an image visible/not visible for each record in a list based on a second collection?

This is really the wrong way around. The Event collection (master data) has the main info eg event details. The Attend collection (detail data) just keeps track of who is attending what event. When a user wants to attend an event I add a record to this second collection with two columns; user id and event id.

The example above seems to assume a 1 to 1 relationship when what I am doing is a 1 to many relationship. I can't have a pointer in my master data to every record in the details data. It would mean I need to have a pointer for every user! Doesn't make sense.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How do I make an image visible/not visible for each record in a list based on a second collection?

Hi Gabriel,

You can create a collection that stores pointers to users and to events.

Gabriel Bizcarra
Posts: 0
Joined: Sun Dec 22, 2013 1:02 am

How do I make an image visible/not visible for each record in a list based on a second collection?

I don't understand how creating a collection of pointers to Events and Users will help? I need to show all events so this will be my primary query. From what I understand a "pointer" points to the automatically created id in a collection. So it's impossible to query one collection and search for a value in another collection if it has a 1 to many relationship. 1 Event will have many users who will go to it.

Querying this new collection with pointers to both users and events will only return values where the user has elected to go to the event. In other words it won't show all the available events.

Think of a dating site, you view all people in a search and if you have communicated or winked or whatever, you can see that you've communicated with them. And you can also see people you haven't communicated with. This site would have a collection with profile and another collection storing people you have communicated with.

This is essentially what I'm trying to do. Show a list of all available events and show a tick image for all those events I have inidicated I'm going to. I have a collection of all events. I have another collection of events I have indicated I will go to. I want to show all the events and show a tick for the ones I'm going to.

Sample Data

colEvents:
Event1
Event2
Event3

colAttend:
User1, Event1
User2, Event1
User2, Event2

Example of What I want to display if I am user1

Event1, show tick
Event2, no tick
Event3, no tick

Example of What I want to display if I am user2

Event1, show tick
Event2, show tick
Event3, no tick

Example of What I want to display if I am user3 (there is no data in colAttend for User3 because they have not indicated they are attending any event)

Event1, no tick
Event2, no tick
Event3, no tick

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How do I make an image visible/not visible for each record in a list based on a second collection?

Hi Gabriel,

Create 3 collections:
User (with columns you need),
Event (with columns you need),
UserEvent (with columns 'user' and 'event' with type=pointer to collections).

Then for a user page you can find all records for this user (http://docs.appery.io/documentation/b...) and get its parameters by event id.

If there are not many events, you can store pointers in a field with type=array.

Gabriel Bizcarra
Posts: 0
Joined: Sun Dec 22, 2013 1:02 am

How do I make an image visible/not visible for each record in a list based on a second collection?

I want to show the user all the available events. Not all events for this user.

Please see the previous example. I think I've very clearly defined the requirement now.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How do I make an image visible/not visible for each record in a list based on a second collection?

Hi Gabriel,

Then you can store an array user_id in a field of events collection.

Gabriel Bizcarra
Posts: 0
Joined: Sun Dec 22, 2013 1:02 am

How do I make an image visible/not visible for each record in a list based on a second collection?

Hi, thanks for your response. I'm trying to understand the array format but it still seems a strange way to do it.

Base on this data:

colEvents:
Event1
Event2
Event3

colAttend:
User1, Event1
User2, Event1
User2, Event2

How can I show the following result set if I am User1:

Event 1, User 1
Event 2, null (or blank)
Event 3, null (or blank)

Return to “Issues”