Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to extract number from field name?

Status
Not open for further replies.

AllyPen

Programmer
Aug 9, 2001
36
US
I have 30 fields in 30 columns named like ColumnHeader1,..,ColumnHeaderN.
I have to create Formula for every field. For example,

@Formula1= trim({rpt_DReport.ColumnHeader1)
@Formula2= trim({rpt_DReport.ColumnHeader2).
The only difference in those 30 formulas will be the actual Number. Needless to say that if I need to do change, I have to do it 30 times - that's really silly.

Question: Is it possible to capture Number from the field name and use it in the formula. I will still have 30 formulas, perhaps, but if I need to change them, I can do it in only one place ( template formula) and all others will use the same code. Any other suggestion will be appreciated.
 
I actually tried that, but formula does expect variable, not field name.
Could you write some sample how to use it, pls?
 
This is one that I used to pull all the charters within a string field up to it reached a period.

shared stringvar firstset := ExtractString ({Servers.Field2},"","."); Brian
 
I'm sorry.. I read right past part of your post.. Saw you are looking at the field name it's self. hmm..
The only thing I can think of is doing something like the following:

Shared Numbervar num1

IF ({rpt_DReport.ColumnHeader1}) THEN
num1 := 1;
Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top