Table Records and List Navigation

Table Records and List Navigation

  

Hi 

I've table record with maximum 5 records displayed and a List Navigation attached to it. The requirement we have received is when ever user adds a record in a table then by default the new record should be highlighted in the table record list.

I'm unable to understand here how to move through each page in the table records and accordingly move the list navigation page.


Any ideas...


Regards


Sunil Babar

Hi Sunil,

How does the user "add a record in a table"? And what does "highlighted" mean in that case? Also, what does that have to do with the List Navigation?

Kilian Hekhuis wrote:

Hi Sunil,

How does the user "add a record in a table"? And what does "highlighted" mean in that case? Also, what does that have to do with the List Navigation?

Hello Kilian

So here, we have a web block to add a record in a table called as "Contracts" and same table is getting displayed in the the table records widget. The records are getting sorted as a field "UMR" which is alpha numeric field.  Now since the record list is very huge, we added a pagination(List_Navigation) and linked it to the table record so that only 5 records are displayed at a time.

Now,  when the user adds a record, it could be shown on 1 page or somewhere in between or at the end . The requirement we had is as soon as the user add a record, where ever it in the table record widget, the radio button next to it should get highlighted.


Regards


Sunil Babar


Hi Sunil,

A suggestion, If possible try to sort the table based on the newly created record on the top , so that we don't want to think about the navigation to the screen where the newly created record.

and try to get the newly created record id and try to pass that to the table to make the highlight, still create new records.

let me know if any other concern..

Regards,

Manikandan K

Hi Manikandan

Well, that the approach we had earlier, however it's the client's requirement that the record should get sorted in ascending manner considering the UMR field. That's one part of it, the other part is when the new record gets selected there are many sub section also should get refreshed but that the later part to deal with

Regards


Sunil Babar

Hi Sunil,

You have a requirement that's not possible to implement. Once the record has been added, there's no (sane) way to determine on what page it is displayed, and even if you knew, the List Navigation cannot be set to a specific page. what Manikandan suggested, just adding it to the start of the list, resetting the page navigation and showing it there, is I think the best you can do.

Ok.  Thanks for the reply Kilian and Manikandan.

Regards


Sunil Babar

Solution

Sunil, Have you considered doing something like this? Table Records select Row after return from Popup

In this solution, a new aggregate is created. Then you find the row number that you need using ListIndexOf. Then you divide by YourTable.LineCount and use that number in a function placed in the StartIndex property of the table. The function would be something like:  

If(IdToNavigateTo <> NullIndentifier(), List_Navigation_GetStartIndex(YourTable.Id, True, Trunc(ListIndexOf.Position/YourTable.LineCount)), List_Navigation_GetStartIndex(YourTable.Id, True)

Finally, you will need to set IdToNavigateTo = NullIdentifier() in the RefreshYourTable screen action that is in the Destination property of the RichWidgets\List_Navigation widget so that when a new page is clicked, users get that page instead of the page you put them on based on the IdToNavigateTo.

Solution

Hi Marcos


Thanks for the solution!

I had to do few twicks but it worked...

In function, i calculate the start index as below, 5 is the Table record list line count. I had to convert the calculate value to a multiple of 5(Line count) to reach a new added record in the list and simultaneously move the List_Navigation widget.

SyntaxEditor Code Snippet

If(Mod(RecordNumber,TableRecordLineCount)>0,Round(((RecordNumber+TableRecordLineCount-1)/TableRecordLineCount))*5,Trunc(((RecordNumber+TableRecordLineCount-1)/TableRecordLineCount))*5)-5

Hi Sunil, I'm glad you got it to work. I had missed multiplying by the LineCount in the example I provided.

Looking at your start index formula, it seems like TableRecordLineCount = 5 = YourTable.LineCount. I'm not sure why you sometimes have the magic number 5 and and other times use TableRecordLineCount. I would suggest you replace TableRecordLineCount and the number five with YourTable.LineCount (this is a property of the Table Widget). This way, if you decide to change the LineCount of the table in the future, your code will still work.

Finally, it seems to me you should not use Round for this and always use Trunc. I suggest the following:

START_INDEX_FORMULA: Trunc(ListIndexOf.Position / YourTable.LineCount) * YourTable.LineCount
03:  Trunc(03 / 5) * 5 = Trunc(0.6) * 5 = 0 * 5 = 0
09:  Trunc(09 / 5) * 5 = Trunc(1.8) * 5 = 1 * 5 = 5
15:  Trunc(15 / 5) * 5 = Trunc(3.0) * 5 = 3 * 5 = 15


For anyone that may run into this later, I've placed START_INDEX_FORMULA in context below.

If(IdToNavigateTo <> NullIndentifier(), List_Navigation_GetStartIndex(YourTable.Id, True, START_INDEX_FORMULA, List_Navigation_GetStartIndex(YourTable.Id, True)

I hope it helps!