Wouldn't it be simpler just to include field 2 in your portal's sort order?
Phil, It is not the requirement! the situation is this: portal records are listed by headers. meaning, those records under same header(header being part of the portal record)must be listed under the header they belong to. however, 'field2',that i referred as, is a field for all portal records where a sequential number (sorted in ascending order) is required regardless of headers. You can see that when a record under header1 is inserted way after header2,3,etc are part of the portal record, this newly inserted record(under header1) will have a a value in 'field2' greater than that of header2,3,etc. as it was inserted way after header2,3,etc. I hope I clarified the problem better this time.
You might try using a script that uses a layout based on the portal records and either a find or Go To Related Records to pull the records up in a found set on that layout and sort them in the desired order. Then, Replace field contents or a looping script can be used to renumber the records in the desired order.
What's not clear from your post is how to determine that correct order just from the number series: 300.01,300.02,300.33,300.02
the correct order is achieved by another field value.
this is the case. when the first item is inserted it gets 300.01, the second 300.02 etc.. when the 10th Item is in it gets 300.10 value in field2. however, it might end up being between 300.01, and 300.02 depending on the sort result on the "header ID" field.
now, I want to regenerate these values of "filed2" such that it is sequential as sorted in the portal.
one possibility is to regenerate everything below this field including the value of it, but could not figure out how to do that. any possibility of using recordID, portalrecordnumber etc. how can we uniquely identify portal rows after a sort operation done on it?
or anyother clue?
This is what I don't understand: If "the correct order is achieved by another field value." Why can't you just include this field in your sort order? That was my original suggestion.
I think some key details are missing here. Before I offer any other suggestion, I'd need a much more detailed description of what you are trying to accomplish here.