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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cross-tab table and recordnumber field 1

Status
Not open for further replies.

sql99

Programmer
Nov 12, 2003
83
0
0
US
Hello,

I have a cross-tab table with a formula (@question) as one of the columns. The formula is displaying the question number - ToText ({QUESTION.QUEST_NUM},0). The question numbers however are not sequential numbers. For example, they're starting from 15 on (15, 16, 17, 18, 19, ...). I would like to add a recordnumber field to have them show 1, 2, 3, 4, 5, etc...I tried creating a formula with RecordNumber in it and replacing it with the @question formula but that seemed to created a big mess. Is there another way for me to have these numbers start w/1? Or is there a way for me to add the recordnumber field inside the @question formula, telling it to start with 1?

Thanks,
sql99
 
Please see thread149-1025096. Substitute totext({QUESTION.QUEST_NUM},"000") for {table.name} in the formula. You do need to sort the main report by the {Question.Quest_Num} for this to work, and it also will not work successfully if you have multiple row fields.

-LB
 
Thanks you for your reply, LB...

Do you know how I can get it to work successfully for multiple row fields?

Thanks,
sql99
 
Actually, I think I was remembering a problem with alternating color in a crosstab. I notice that you actually are trying to apply this to a column not a row. I couldn't recreate the problem that I ran into before, which was using the variable as a row field and then adding additional row fields. Have you tried my suggestion? Maybe it will work with multiple columns. Be sure to refresh the crosstab after adding the new field.

-LB
 
Hi LB,

I looked at the thread you wanted me to see --- do I need the following formula:

whilereadingrecords;
numbervar linecnt;
stringvar name;

if instr(name,{table.name}) = 0 then
(name := name + {table.name};
linecnt := linecnt + 1);
linecnt

Also, you asked me to substitute totext({QUESTION.QUEST_NUM},"000") for {table.name} in the formula. Should I remove everything from the existing gformula and replace it with this?

Sorry for asking so many questions...I'm very new to crystal reports. Thanks for being patient w/me.

sql99
 
Try:

whilereadingrecords;
numbervar linecnt;
stringvar qno;

if instr(qno,totext({QUESTION.QUEST_NUM},"000")) = 0 then
(qno := qno + totext({QUESTION.QUEST_NUM},"000");
linecnt := linecnt + 1);
linecnt

Be sure to sort the main report by {QUESTION.QUEST_NUM} before implementing this.

-LB
 
Thank you so so much LB, it worked like a charm!! You've made my day :)

sql99
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top