Adding spaces to text

R

rKp

I am wondering if this is possible. I have 2 columns in a table:
Table Name : TESTTAB
Column Name1 : Depth, stores number
Column Name 2 : Name, stores text

Sample Data
Depth Name
-------------------
1 Master
2 Chief
3 Super
2 Admin
4 Paralegal

Is there a way to display as follows:

Master
Chief
Super
Admin
Paralegal

That is, convert the depth into prefixed-spaces or tabs?

I dont mind running a SQL to update the base table as well. But even this
has to be at run time since this table is overwritten by another process
frequently.

TIA
 
D

Dirk Goldgar

rKp said:
I am wondering if this is possible. I have 2 columns in a table:
Table Name : TESTTAB
Column Name1 : Depth, stores number
Column Name 2 : Name, stores text

Sample Data
Depth Name
-------------------
1 Master
2 Chief
3 Super
2 Admin
4 Paralegal

Is there a way to display as follows:

Master
Chief
Super
Admin
Paralegal

That is, convert the depth into prefixed-spaces or tabs?

I dont mind running a SQL to update the base table as well. But even
this has to be at run time since this table is overwritten by another
process frequently.

If you don't need the data to be updatable when you display it this way,
you can use a query like this:

SELECT String([Depth] - 1, " ") & [Name] AS ShowName
FROM TESTTAB;
 
Top