Hi all. could you help me? I’m trying to make a user data page on a website. Users on my site can post ads. In the database User that I’m displaying on the page, I have the user’s email address, their name, and I need to know how many ads they’ve posted on the site.
I linked the ad database to the user database. The user’s email and name are written to the ad database without problems. But in the user database, the announcements made by the user are not recorded. How can I solve this problem and display the number of ads that a particular user has left. Thanks
Hi there, @bluesun440… if I understand your post correctly, you didn’t link the Ad data type to the User data type correctly, however, I’m wondering if that even matters. If you want to show a user how many ads they have posted on the site, can’t you simply do a search for things in the Ad data type that were created by the current user, and add the :count operator to the end of the expression? Have you tried something like that already?
Thanks for the answer, but not really. I want to make a table so that the site administrator can see a list of all users and see the number of ads left by each of them. I have a repeating group on database user and that’s where I get all the user data from. The problem is that information about the user’s ads is not written to this database. Maybe there is some other way?
If you want to use the User data type, you could have a field on that data type that is a list of ads (not a text field like you are showing in your screenshot). Then, when a user creates an ad, add the newly-created ad to the user’s list field. At that point, getting the total number of ads for each user would be as simple as doing a count of the list field. Oh, and you would have to make sure the privacy rules on your User data type allow the site administrator to see the data associated with the other users.
I created a list of ads in database User, but I can’t select it when creating the workflow. I suppose that the user data type, which is by default when creating any project, is used only for registration and authorization, and nothing can be added to it? And if I create a new data type, then everything works fine, as you said. But the problem is that I am shown emails that are duplicated many times. For example, if a user has published 10 ads, then I will see his email 10 times. According to my plan, one row in the table for information about one user) Is it possible to somehow group them so that only the email of one user is displayed, even if he left a lot of ads?
You don’t create a new add in the User data type. You will make changes to the current user, and you will add the result of step 1 (the newly-created ad) to the user’s ads list field. I believe you could also use the user ads data type and group the results by user.