equivalent of next/previous record ?

View and download documents on various topics e.g. Configuring Ebase Xi under different environmental setups

Moderators: Jon, Steve, Ian, Dave

cagabit
Ebase User
Posts: 11
Joined: Fri Nov 20, 2015 6:10 pm

equivalent of next/previous record ?

#1

Postby cagabit » Sun May 01, 2016 3:33 pm

Hi,

Trying to setup a form app, lets browsing of records from database one by one, classic implementation would be "next record" "prev record" buttons.

In ebase, is the .fetch method only available method for this ?

Like find , using fetch seems to be not the best performance way!

Asking for resource-field connection but any other implementation like using table maybe ?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Tue May 03, 2016 8:47 am

You could use a table and then display it one record at a time. It depends how many records there are - table records are held in memory so if there are lots (say 500+) you probably don't want to do this. Reading each record with a separate SQL statement is not the most performant solution but I doubt if you could detect much difference in the response time.

If you decide to go down the table route, you would need to drag the table columns into a container such as a Panel Control to display them, and then adjust the table's current row when the user clicks the next/previous buttons e.g.

Code: Select all

tables.MyTab.currentRow = tables.MyTab.currentRow + 1;
Obviously, you would also need to enable/disable the buttons depending whether there is a next/previous row.
0 x

cagabit
Ebase User
Posts: 11
Joined: Fri Nov 20, 2015 6:10 pm

#3

Postby cagabit » Tue May 03, 2016 4:09 pm

Thanks jon.

Not against getting one-by-one with SQL by fetching from the resource, but
I was wondering how we could get the next record ID ( the reference to use for the fetch from the resource), I have a ID column in DB.

Tried a hybrid; listing the data first in a grid with a table, then when clicked a record navigating to another page with some details as fields, coming from a resource.
When navigating the record , getting the ID from the table, and also navigating the table ( no need actually, because the user is looking details a one record per page , but have to be done to get a reference )

Still have a doubt, whether doing the right thing or not !

-----------------------------

My mistake maybe , let me summarize what I am trying to do :

Typical contacts application. First page lists contacts with some of the fields, coming from 3 different tables ; contacts, tels, emails connected with the ID field. I used a SQL join in the resource to list these as one table.

When you click a record, navigates to the details page and shows all fields of the contact, tels and emails in a new page. In this page the user can goto next or prev record by buttons. Also can update or insert a new record in this page. So for this page used 3 other resources, for the contact, tels and emails.

For record navigation as tried to explain at the top, getting the ID from the table at the list page and fetching the record from the resources accordingly. And also navigating the table at the list page not to loose the reference of the ID field. For each navigation action checking if the table is at start or end.

Do you think this should be done like this in ebase or any other advice ?
May be using a second table also for the details page ?


And let me criticize a little ; these actions are so common that , they could be done more easily, which have some examples in other platforms.I am not experienced in web development, so maybe missing some points but seems to me like that.
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#4

Postby Jon » Tue May 03, 2016 5:15 pm

I think I understand, not 100% sure. It all sounds fine to me, I think I would do it the same way: display a minimal table as a navigation device then fetch the detailed data with other resources when the user asks for it, and allow them to update at this point (Note: you might have to re-issue the fetchtable if they change anything that affects the first page display, then find the row using its ID and set that as the current row).

Also, you should be able to implement the next/previous buttons just by changing the table's current row (as I said in the first post) and then executing the same code as your navigation script (the script that runs when the user clicks on a contact from the first page). You probably need to implement most of this code as a function to enable you to do this.
0 x

cagabit
Ebase User
Posts: 11
Joined: Fri Nov 20, 2015 6:10 pm

#5

Postby cagabit » Tue May 03, 2016 6:50 pm

Thanks for the "Note" reminder, really missed at this time :)
0 x


Who is online

Users browsing this forum: No registered users and 4 guests