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

conditional Hierarchially group indent

Status
Not open for further replies.

vincer

Programmer
Mar 12, 2002
45
GB
I want to be able to indent certain fields in a hierarchy but have some fields always fixed to a certain position.
Eg like a table of contents.

heading 1...........page 1
heading 1.1.......page 4
heading 1.1.1...page 5
heading 2...........page 7

Is there a way using the hierachical grouping option that I can either get the hierarchy level (so that I can add spaces myself) or fix the column?

Thanks
 
Dear Vincer,

Well the hierarchical option wants to know a field to treat as the "parent" so if you have information from which that can be gleaned then yes it could work.

You could also do things with instr and spaces added.

Have you tried anything yet?

ro Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
My example didn't come out quite as expected due to proportional font. But in answer to your question, yes , I've used the hierarchical group option with the indent level set to say 0.5cm. The problem is it indents everything in the detail and group section at the hierarchy level. I only want it to indent one of the columns in the section and leave the other column displayed at say, 8cm

Thanks
Vince
 
Dear Vincer,

So, to restate the goal is to indent everything that should be at the same level the same number of spaces.

You could do:

//start
numbervar ind;

ind := if instr({Table.HeadingFld},".")) = 0 then 5 else (instr({Table.HeadingFld},".") * 2)+5;

ReplicateString(" ",ind) & {Table.HeadingFld}
//end

I didn't have a chance to check it, but I saw SynapseVampire post something similar a while back.

Your result:
Indent 5 char
Indent 7 char
Indent 9 char
Indent 5 char
Indent 7 char
Indent 9 char

Play with it till the padding looks good to you.

ro

Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
Okay, well just after the submit I went back and read your post and now I caught the bit about how you want 5 and 8 so it should be:

//start
numbervar ind;

ind := if instr({Table.HeadingFld},".")) = 0 then 5 else 8;

ReplicateString(" ",ind) & {Table.HeadingFld}
//end

Result:

Indent 5 char
Indent 8 char
Indent 8 char
Indent 5 char
Indent 8 char
Indent 8 char

Hope that helps, I still can't test as I am on a machine without Crystal.

Ro
Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
I did an example of this in Crystal Clear 28. It requires hierarchical grouping and a variable to keep track of what level in the hierarchy you are in.

Email me and I'll send you the demo I used to solve this problem. (anyone else welcome as well) Editor and Publisher of Crystal Clear
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top