Error on pagination exercise

I was doing the pagination and sorting tutorial exercise and when I published and change the number of records, I got this error message:

"Unable to convert Infinity to the Integer type since it exceeds the maximum value allowed which is 2147483647. Check the JavaScript node 'GetToltalPages' of the action 'InitPagination'. "

I saw another question in this forum https://www.outsystems.com/forums/discussion/67367/how-do-i-solve-this-pagination-javascript-node-error/, but i think the solution is not correct. 

The error occurs in a lapse of seconds between the moment I delete the number and start writing another one. Even if I set a default value for "NewStartIndex", the error message persists. 

How can I solve this problem? Again, the solutions exposed in the link above were not efficient in making the error message disappear

errorpagination.png

Solution

I understand your logic and is correct, and the error is really on the input where it cannot be null because it's going to give you an error, I just have 2 points,

  • careful with the maximum of the input max records of the pagination
  • at the pagination you need to put newStartIndex, because if you pass 0, you are going to be always at the start... try your solution, you are going to see the error or bug :)

I found the solution. The problem was updating the GetEmployees aggregate using "0" or null as MaxRecords. The two of you, Márcio and Vaibhav, proposed a conditional to look at the input value, but after that the flow kept updating the aggregate, regardless of whether the conditional value was true or false. The Vaibhav solution disappeared with the message but made it impossible to erase the number, something that is not seen on the websites. Therefore, the solution was to drive to "end" if MaxRecords was "0" or null. This way, the message disappears and it is possible to erase the number and write another one. Anyway, I thank you both, because with the contribution of both we arrived at the solution.

Hi ALMIR,

I tried the attached oml file and was facing same issue. But, I found a work around. I have attached the updated  oml file.

1 - The variable you are passing to Refresh action in Navigate handler of Pagination component is wrong. It should be 0. The same is given in pdf file on page 17. please see images.


2. I created a new local variable NoOfRecords of Integer type and assigned it as the variable for input box.


3. Then I changed the Refresh and OnSort Action.


This stopped the error display.


Vaibhav Gijre

PaginationandSortingExercise_01.oml

Solution

I understand your logic and is correct, and the error is really on the input where it cannot be null because it's going to give you an error, I just have 2 points,

  • careful with the maximum of the input max records of the pagination
  • at the pagination you need to put newStartIndex, because if you pass 0, you are going to be always at the start... try your solution, you are going to see the error or bug :)

Hi Márcio,

My mistake. I was so focused on the error issue I forgot to properly test the solution.

For your point 1 - Yes, we need to be careful while using the max records.

For your point 2 - Yes the input for the Refresh action should be NewStartIndex as that is the input of OnNavigate event.

Vaibhav :)

I found the solution. The problem was updating the GetEmployees aggregate using "0" or null as MaxRecords. The two of you, Márcio and Vaibhav, proposed a conditional to look at the input value, but after that the flow kept updating the aggregate, regardless of whether the conditional value was true or false. The Vaibhav solution disappeared with the message but made it impossible to erase the number, something that is not seen on the websites. Therefore, the solution was to drive to "end" if MaxRecords was "0" or null. This way, the message disappears and it is possible to erase the number and write another one. Anyway, I thank you both, because with the contribution of both we arrived at the solution.

Great!!!!! We are very happy that we helped you! :)

Kind regards,

Márcio

I am happy that you were able to resolve the issue. Thanks to you too Márcio, for making me realize my mistakes.

Vaibhav. 

Hello!! Can you share an OML to see how r you doing the pagination? 

I could not open the link you shared, it gives me an error.

Kind regards,

Márcio

Ok, look at my code

PaginationandSortingExercise.oml


Why are you doing this? Placing the max records variable on the input search and the PaginationOnNavigate when you are going the search.

You need to use a search keyboard variable, and the onChange action is not onPaginate, is onSearch :D Try to place the employee's entity again on the flow, and you are going to see what I mean.

Also, your sort action is quite different from the normal ones.


Drag and drop the entities employees. And you are going to get the correct scenario that you want.

Unfortunately, my Service Studio is with problems and I cannot install your OML or send a solution, very sad I know :(

 This is what you must have



Kind regards,

Márcio

I did exactly what the tutorial says. When I switched to Search, I got an error. I repeat the exercise step by step and the error message still appears.

Pagination and Sorting Exercise.pdf

I think you did everyhting ok. What happen is that just when i put 0 or more than the maximum value, 2147483647 is going to give me an error.

I try your OML and is working fine.

And its also giving you an error, because when you erase the input parameter, the max records dont have any value is null, and thats why is giving you an error. So i would advice you to put again ther default value at 10 when you delete the input... That way is not going to give you any error... :)

Do this


PaginationandSortingExercise.oml

It doesn't work, the message still apears.

Hi Almir,

As I see the link you posted and your description, I think the issue occur on OnChange event of the page input.

I guess that you can try to check the action if page variable is empty or 0 then return else can continue the logic.

Hope this helps,

Khuong

I tried to put an if before the assign, but it doesn't work

mvp_badge
MVP

You assume the solution in the link  https://www.outsystems.com/forums/discussion/67367/how-do-i-solve-this-pagination-javascript-node-error/  is not correct.  But why can there not be different reasons for the error?

The described solution was apparently correct for that community member to fix his problem. Maybe your problem is just different.

That's why I put this link, to prevent others from directing me to this solution. I don't know why it worked for that guy and not for me.

Hi ALMIR,

I tried the attached oml file and was facing same issue. But, I found a work around. I have attached the updated  oml file.

1 - The variable you are passing to Refresh action in Navigate handler of Pagination component is wrong. It should be 0. The same is given in pdf file on page 17. please see images.


2. I created a new local variable NoOfRecords of Integer type and assigned it as the variable for input box.


3. Then I changed the Refresh and OnSort Action.


This stopped the error display.


Vaibhav Gijre

PaginationandSortingExercise_01.oml

Solution

I understand your logic and is correct, and the error is really on the input where it cannot be null because it's going to give you an error, I just have 2 points,

  • careful with the maximum of the input max records of the pagination
  • at the pagination you need to put newStartIndex, because if you pass 0, you are going to be always at the start... try your solution, you are going to see the error or bug :)

Hi Márcio,

My mistake. I was so focused on the error issue I forgot to properly test the solution.

For your point 1 - Yes, we need to be careful while using the max records.

For your point 2 - Yes the input for the Refresh action should be NewStartIndex as that is the input of OnNavigate event.

Vaibhav :)

I found the solution. The problem was updating the GetEmployees aggregate using "0" or null as MaxRecords. The two of you, Márcio and Vaibhav, proposed a conditional to look at the input value, but after that the flow kept updating the aggregate, regardless of whether the conditional value was true or false. The Vaibhav solution disappeared with the message but made it impossible to erase the number, something that is not seen on the websites. Therefore, the solution was to drive to "end" if MaxRecords was "0" or null. This way, the message disappears and it is possible to erase the number and write another one. Anyway, I thank you both, because with the contribution of both we arrived at the solution.

Great!!!!! We are very happy that we helped you! :)

Kind regards,

Márcio

I am happy that you were able to resolve the issue. Thanks to you too Márcio, for making me realize my mistakes.

Vaibhav. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.