DMXzone App Connect Data Traversal Support Product Page

Answered

Limit records shown based on value in database

Asked 28 Nov 2017 19:48:01
1
has this question
28 Nov 2017 19:48:01 steve kirchuk posted:
I am confused as to what product to use to limit the number of records in a query ... I have tried app connect query id, data transversal, and app connect data formatter ..

Replies

Replied 29 Nov 2017 08:12:05
29 Nov 2017 08:12:05 Teodor Kuduschiev replied:
Hi Steve,
You can limit the number of records shown on the page in two ways:
1. By using a paged query
2. By using a normal query and applying the "top" filter of App Connect formatter
Replied 29 Nov 2017 13:41:59
29 Nov 2017 13:41:59 steve kirchuk replied:
Hi ... I've tried that on the repeat .. the RegLimit value is from the db query .. when I add that nothing shows on the page ..


<div dmx-repeat:repeat1="registered_members.data.registered_query.top(RegLimit)">{{UserLastName}}, {{UserFirstName}} &raquo; {{RoleName}}</div>
Replied 29 Nov 2017 14:16:46
29 Nov 2017 14:16:46 steve kirchuk replied:
the next part of that is to show records above the limit value in a 2nd repeat ...
Replied 29 Nov 2017 14:17:41
29 Nov 2017 14:17:41 Teodor Kuduschiev replied:
Hi Steve,
your request is a bit unclear. Can you please clarify a bit what exactly needs to be done on your page?
Replied 29 Nov 2017 14:38:29
29 Nov 2017 14:38:29 steve kirchuk replied:
sure .. I have a db query that returns all people who have registered for an event .. I want two repeats on the page .. one will list the records up to a count of a field value from query.RegLimit .. the second repeat will list any records after that value which will be a wait list for attendance
Replied 29 Nov 2017 14:40:40
29 Nov 2017 14:40:40 Teodor Kuduschiev replied:
How is the reglimit field added to your table?
Is it one value in the table? Is it repeating in each table row (for each attendee)? Are the attendees in the same table?
Replied 29 Nov 2017 15:05:37
29 Nov 2017 15:05:37 steve kirchuk replied:
i joined the event table and the registration table on 2 EventID & RegEventID .. so I'm grabbing the RegLimit from there so yes, I guess that field is repeated as well .. should I pass the value thru a url filter?

I guess the other thing I am struggling with is how to choose between extensions for queries and repeats ... App Connect vs Transversal vs Formatter vs Server Connect Formatter

thanks again for your patience !
Replied 29 Nov 2017 15:10:02
29 Nov 2017 15:10:02 Teodor Kuduschiev replied:
I think this is the issue - somehow probably the tables are not joined properly or the result they return is not good. Please send me a link to your page, where i can check what you are doing wrong, you can use to send it.

Actually it is not App Connect vs Data Traversal (data traversal is extending app connect functionality, not replacing it) ... and Server Connect Formatter is not even used on the front-end.

In your case, just use app connect formatter, but let me first inspect your page to see what is wrong.
Replied 29 Nov 2017 17:53:27
29 Nov 2017 17:53:27 steve kirchuk replied:

nec2glax.org/ use login: / pass

then paste this url in the browser

nec2glax.org/register.php?eid=324
Replied 29 Nov 2017 19:03:45
29 Nov 2017 19:03:45 steve kirchuk replied:
I think I have a handle on the top functionality - it's just a matter of getting the value from a recordset .. I have validated that it works when I hard code a value ...

what app connect formatting do i use to start after a certain amount of records .. say I want the repeat to begin at the 11th record in the db ?
Replied 29 Nov 2017 19:41:16
29 Nov 2017 19:41:16 steve kirchuk replied:
I created a new query and grabbed the RegLimit value from that and used that for the .top() value and it works !

So, next I need to add all the records excluding the ones shown in repeat # 1 ..so if the .top() count is 2, I want to start at record 3
Replied 30 Nov 2017 09:27:07
30 Nov 2017 09:27:07 Teodor Kuduschiev replied:
Hi Steve,
Yes, using a separate query is the way to go. If you are using a binding from the repeat, it returns multiple values, not a single one.

As for the second repeat you need to show all, except the first X records. So the formula is: repeat LAST(ALL RECORDS - X) where X is the same value from the query used in the first repeat.
So with app connect and app connect formatter it will look like:


<div dmx-repeat:repeat2="serverconnect1.data.queryName.last(serverconnect1.data.queryName.count() - X)">



Replied 30 Nov 2017 13:29:17
30 Nov 2017 13:29:17 steve kirchuk replied:
OK Thanks Teodor ! I really appreciate your patience ... that's why I love DMX ... fabulous tech support !

Reply to this topic