Subject Re: Another problem (non-grid)
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Sun, 17 Dec 2017 14:23:35 +0530
Newsgroups dbase.getting-started

On 17/12/2017 13:46, Akshat Kapoor wrote:
> On 17/12/2017 04:10, Charlie wrote:
>> Thanks for the help on the grid problem.
>>
>> OK now I am wondering how someone would program this.  Should be
>> pretty easy but I was on the golf course today and am to golfed out to
>> think!
>>
>> So I have a character field.  I am organizing it now so it will look
>> presentable.  I have been using 1,2,3,...12 and now I want to show
>> this in a logical order.  So I would like all characters to look
>> something like 001, 002, 003,...012 so they make a more logical order.
>>
>> I have many records that are of the first example.  Would there be an
>> easy loop to fix them to resemble the second example?
>>
>> Thanks again!!!!   Happy holidays everyone!
>>
>
> Hi Charlie,
>
> This is just to add to Mervyn's methods
> ?str(5,4,0,"0")
> ?str(val("  5"),4,0,"0")
> ?str(val("5   "),4,0,"0")
>
> all give "0005" as the output
>
> So your data is " 5 " / "  5" / "5  " the resultant order will be the same.
>
> If you allow editing in a grid it will be difficult to control your
> input to any one of the above formats.
>
> Check OLH for str() the fourth optional parameter ("0" string 0 ) is
> used to fill the empty spaces if the generated character is short of the
> required length.
>
> You can also create an index on this
>
> use yourTable excl
> index on str(val(yourField),4,0,"0") TAG yourField
>
> You should get the desired results.
>
> Regards
> Akshat

Just an after thought
index on str(val(yourField),4,0,"0") TAG yourTagname will set the proper
order but it will not alter the value that is being displayed/stored.

Regards
Akshat


Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0