You need to sign in to do that
Don't have an account?
Ravi_SFDC
Sorting Code Issue
I am trying to update these numbers (sorting). If i provide the same number it should give me an error only when i click the update button. Please find my APEX Code as below
I have defined the data type as integer but it is giving the error as above and it should message me that if it is true or false on the visual force page. Can you please suggest.
1. No issues here as you are not able to sort with 2 same numbers and error is displaying. Right?
2. To display success message add
after the update actPList; in the IF block.
3. I am assuming
will return to the the record detail page. doing so will not display the success/error message. You can add a output panel which has back button to go back to previous page
Not knowing how your application is designed is a little hard there may be other better options too.
All Answers
Number fields are saved as Decimal in salesforce.
So change your line to
in VF page
make sure you have
Thank you Badi. I am still getting an error as below.
Error: unexpected token: 'else' at line 65 column 20
Please check the whole APEX Code and do suggest.
make this change and try again, let me know if it doesn't work
Hi Bhavana, still have an issue, please find the code as below
Hi, Please see the final code. As i was not able to final any '' (double quotes). But the below code is saved with no issues. Nothing is getting changed.
My Requirement - Please see the below screen shot
When i click on the UPDATE button, it should check for the sorted numbers. If the user is trying to save any of the existing sorted numbers with the same number it should give me an error, or else save with the updated (changed sorted numbers) with successfully message. Kindly suggest with the code.
My VisualForce Page Code
My APEX Code too
or do you want to check say ABC was in sort number 1 and after changing it is not in number 1 any more?
2. I should also be able to change the sorting sequence at the same time no two numbers should be the same.
2. I should also be able to change the sorting sequence at the same time no two numbers should be the same.
2. I should also be able to change the sorting sequence at the same time no two numbers should be the same.
VF
Apex
Hi Badi, Thank you for the response.
1. If i am trying to save the two sort numbers as same, it is not taking, Important thing is it is not giving any message on the page. (Which is actually needed)
2. I am able to change the sorting sequence but remaining same as in point number 1.(Hear too no successful message displays)
Please suggest.
Please make sure <apex:pageMessages /> is on your Visualforce page (refer to my code pasted in my previous repsonse) and instead of your page returing try return null
Let me know if that fixes the issue
Hi Badi, I do have <apex:pageMessages /> in my VF page.
Now i checked and made changes and tried with return null it is working fine with no issues.
1. When i have the 2 sort numbers with the same value it is giving me error message., that sorting number already exists.
2. When i have the sorting sequence changed it is working fine with no success message.
3. But in both (1 & 2) cases it should return to the previous page after following the (1 & 2 steps). Please suggest.
1. No issues here as you are not able to sort with 2 same numbers and error is displaying. Right?
2. To display success message add
after the update actPList; in the IF block.
3. I am assuming
will return to the the record detail page. doing so will not display the success/error message. You can add a output panel which has back button to go back to previous page
Not knowing how your application is designed is a little hard there may be other better options too.