# Set Record Field with Alphabetical Sort

## Recommended Posts

I have another request since I can't code even to survive, and hopefully someone has already have one written somewhere but I was not able to find it.

This time, I'm looking for an alphabetical sort script which will set the record field from A to Z on a stacking order basis or some other basis ... idk.

Any ideas, or line of codes?

There is an array sort function in vectorscript. It can also be used on structures.

Thank you hippo, I know it related with that function but ...

I can't code even to survive
guess I'll have to get into VS and Python a little more.

What are you actually trying to do? If you want to set a field in a record, especially if you are OK with doing it by stacking order, you don't need a sort function.

I post a script to write data into a record a few days ago. See

If you can describe what you really need, perhaps I can modify this to do what you want.

Hi Pat,

You know what I'm trying to do; I'm trying to assign letters to record fields inside a worksheet. So you remember this code right;

```Procedure Number_Objects;

{October 1, 2014}
{? 2014, Coviana, Inc - Pat Stanford pat@coviana.com}

const	MyRec='Test';
MyField='Seq';

Var		NextNum: Integer;

Procedure MyProc(H2:Handle);
Begin
SetRField(H2,MyRec,MyField,Num2Str(0,NextNum));
NextNum:=NextNum+1;
End;

Begin
NextNum:=1;
ForEachObject(MyProc,((R IN [MyRec])));
End;

Run(Number_Objects); ```

I'm trying to do the exact same thing but with letters now, if I'm explaining myself clearly.

chr(number) turns asci into characters. If you look up "A" or"a" you can to set a loop a-z in order.

I get what you're saying ... I will have to sit down sometime and go over my basic CS skills to put this into practice but I don't have much time these days. Although thank you for the guidance, much appreciated.

Are you going to have more than 26 objects?

If not, then you can use

SetRField(H2,MyRec,MyField,CHR(64+NextNum);

If you want lowercase use 96+NextNum

If you are going to have more than 26, what should come after Z?

I think what Hippo said makes sense, so I think "AA" should come after "Z" and loop like that (which I don't know how that will work in code). Same for lowercase. But I'll start playing with the stuff you just provided Pat, thanks a lot.

You need to decide what the maximum value you are going to handle is before you start trying to write code to convert to base26.

The code will probably be very different if you only need to go to ZZ instead of ZZZ.

You will have to determine each letter separately and then use Concat to put the string together.

I got you Pat, alright well my maximum value is not more than 26 at this point so I'll go with CHR(64+NextNum). I'll do the "ABC..AABBCC" loop later on, and let you guys know how it goes. Thanks again for the help everyone.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×