Question
Synechron
IN
Last activity: 18 Nov 2016 4:16 EST
Regarding updation of values in one column
How to update the values of one column based on user input.Suppose i have 10 values in one column as 1,2,3....9,10.If I change any value lets say 5 to 1 and 10 to 2.Then the Sequence of 1,2,3,4,5,6,7,8,9,10 should change to 3,4,5,6,1,7,8,9,10,2 and the values should update in DB after the changes was made.
***Updated by Moderator: Marissa to update categories***
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
BlueRose Technologies
AU
Hi BalaRaju,
You can use data transform for setting the values as 3,4,5,6,1,7,8,9,10,2.
In the above sequence, we can find the logic as
1) increment every no with value of 2. (1+2 =3, 2+2 =4, 3+2 =5, 4+2 = 6, 5/5 = 1 , 5+2=7, ......,10/5 = 2)
2) Divide with 5, if the count is divisible by 5.
Thanks,
Prudhvi
Synechron
IN
Hi Prudhvi,
Not only for the above case i.e.,5 and 10.If i change any value it should update accordingly.
Thanks,
BalaRaju
Pegasystems Inc.
IN
Assuming you are using grid, have you tried disabling the sort option of the column ?
Synechron
IN
Hi Battacharjee,
Can you please elaborate.On change of any value from the list 1 to 10.Lets say 4 to 1 then the sequence of 1,2,3,4,5,6,7,8,9,10 should change to 2,3,4,1,5,6,7,8,9,10.
thanks,
Balaraju.
Pegasystems Inc.
IN
Your initial set of data is : 1, 2, 3, 4, 5, 6. 7, 8, 9, 10
You are changing 4 to 1
So new set of data will look like ,
1, 2, 3, 1, 5, 6, 7, 8, 9 , 10
But you want to change it to
2,3,4,1,5,6,7,8,9,10
So are you also trying to delete the 1 which was initially present at the beginning ?
Synechron
IN
Exactly,not only for 10 numbers should applicable for N no.of numbers.If i change any number in the sequence lets say from 1 to 100,you change 9 to 3 and 88 to 2 ,then it should be 1,4,5,6,7,8,9,10,3,11,12,.....84,85,86,87,88,2,89,90 .......99,100.
Pegasystems Inc.
IN
Hi BalaRaju, Could you please share a rela time use case in your project where you are trying to implement this logic.
Synechron
IN
Please find the attched file.By default the values will be in that Sequence.If user change any value then it should update as in the above scenario.
BlueRose Technologies
AU
Hi Balaraju,
Make a count of no of values you changed and their indexes.
Ex: sequence lets say from 1 to 100,you change 9 to 3 and 88 to 2 ,then it should be 1,4,5,6,7,8,9,10,3,11,12,.....84,85,86,87,88,2,89,90 .......99,100.
So, count = 2 and need to change indexes are 9,88. Values which has to replaced are 3,2.
Starting index value which got removed is least value among (3,2) so it is 2.
So, we will start the sequence until its value (2). Ex: 1, ........
From the index value of 2, increment the value with the count. So, sequence will be 1,2+2,3+2,..... which will be 1,4,5,6,...
Then need to change indexes are 9,88. So, when pyForEachcount reaches value of 9 then, get the first value from value which has to get replaced. i.e. 3 and append the value in the sequence. Then count(value needs to be changed) will be reduced to 1 and the next values in the sequence will be incremented by 1 after insertion.
Sequence will be 1,4,5,6,7,8,9,10,3,10+1=11,11+1=12,12+1=13,13+1=14.....
When it reaches index 88, then 2 has to append in the sequence and count will be reduced to 0.
Finally, sequence will be 1,4,5,6,7,8,9,10,3,11,12,.....84,85,86,87,88,2,89,90 .......99,100. This is the logic.
Please let me know if you need any help.
Hi Balaraju,
Make a count of no of values you changed and their indexes.
Ex: sequence lets say from 1 to 100,you change 9 to 3 and 88 to 2 ,then it should be 1,4,5,6,7,8,9,10,3,11,12,.....84,85,86,87,88,2,89,90 .......99,100.
So, count = 2 and need to change indexes are 9,88. Values which has to replaced are 3,2.
Starting index value which got removed is least value among (3,2) so it is 2.
So, we will start the sequence until its value (2). Ex: 1, ........
From the index value of 2, increment the value with the count. So, sequence will be 1,2+2,3+2,..... which will be 1,4,5,6,...
Then need to change indexes are 9,88. So, when pyForEachcount reaches value of 9 then, get the first value from value which has to get replaced. i.e. 3 and append the value in the sequence. Then count(value needs to be changed) will be reduced to 1 and the next values in the sequence will be incremented by 1 after insertion.
Sequence will be 1,4,5,6,7,8,9,10,3,10+1=11,11+1=12,12+1=13,13+1=14.....
When it reaches index 88, then 2 has to append in the sequence and count will be reduced to 0.
Finally, sequence will be 1,4,5,6,7,8,9,10,3,11,12,.....84,85,86,87,88,2,89,90 .......99,100. This is the logic.
Please let me know if you need any help.