During integration, I was thinking on how I could display the search results a little neater, for various lengths of data.
I came up with using a fixed width font, such as courier then in the calc which creates the results, I simply added a number of spaces depending on the data being returned
i.e
Case (not IsEmpty ($disp1) ; Left($disp1 & " " ; 8 )) &
For this particular field, it was only ever going to have a max of 8 characters, so when only 2 where used, 6 spaces would be added to the end.
I then decided to add column headers, altough this required a little 'hard-coding' I think its quite neat...
To do this, I copied how the initial header was being added, then wrapped it in If / Else statements
If [$param = "01"]
Set Field..... my headings using fixed width font
Then increased the line & record count by 1.
[else if $param = "02"] etc etc
The end result can be seen below.
P.S This is still a work in progress
Using a fixed width font
6 posts
• Page 1 of 1
Posts: 135
Joined: Fri Sep 28, 2007 3:09 pm Location: UK |
|
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am |
LOVE the screenshot!
John Sindelar
SeedCode |
Posts: 135
Joined: Fri Sep 28, 2007 3:09 pm Location: UK |
Thanks John...
Altough it only took me 30 mins to integrate and get working, ive spent all day tweaking it to my liking... Im loving the functionality and how easy it is to work with, its not complicated atall... |
Posts: 65
Joined: Wed Dec 16, 2009 9:04 am |
Ho did you put the field names across the top like that?
Kaostika |
Posts: 135
Joined: Fri Sep 28, 2007 3:09 pm Location: UK |
I copied the code used to add the initial headers, then increased the line & record count by 1, since the header would be counted as an extra line used.
Edit the script : Create Result Lines Where the comment #Write table header, is you will see the initial header being created. Below that and before the #++++++ line I added ----------------- if [$param = "01"] Set field [SR_SearchResults::SR_ResultText[$$sr Line Count] ; "My Custom Headers Hard Coded not dynamic" ] Set Variable $$sr Line Countl Value:$$sr Line Count +1 Set Variable $record counter; Value: $record counter +1 Else if [$param ="02"] Repeat above .......... depending on how many tables are being searched End If ----------------- Ive since added custom formatting to look for my hard coded headings, so I can make them look more like actual headings. Hope this helps... And Happy New Year ! |
Posts: 65
Joined: Wed Dec 16, 2009 9:04 am |
I have 2 CF now. I set the length of each display field in the actual size of the field on the layout. The first Cf get the size of the text box the second adds spaces the the text. the script step is the on that sets the $disp01 etc variables. In this way there is no "programming" for the size of the text. I haven't figured out how to put the field names dynamically yet.
-------------------------------Script step -------- Case ( Get (ActiveLayoutObjectName) = "Display01" ; FixedLength ( Get ( ActiveFieldContents ) ; " " ; fieldlength ; "left" ) ) ---------------------CF 1)------------------------- Round ( (MiddleWords ( FieldBounds ( Get(FileName) ; Get(LayoutName) ; Get ( ActiveFieldName ) ) ; 3 ; 1 ) - MiddleWords ( FieldBounds ( Get(FileName) ; Get(LayoutName) ; Get ( ActiveFieldName ) ) ; 1 ; 1 )-1 )/7.3 ; 0 ) ---------------------CF 2)------------------------- /* FixedLength function Author Daniele Raybaudi Format FixedLength ( text ; char ; charsNumber ; align ) Parameters text - any text or text field char - any character (or string); charsNumber - the fixed length of the resulting string align - text that can assume the value of "Left" or "Right"; an empty string is the same of "Left" Data type returned text Description Returns a fixed length string. For example, FixedLength ("aaa"; "0" ; 10 ; "Left" ) returns: aaa0000000; FixedLength ("aaa"; "0" ; 10 ; "Right" ) returns: 0000000aaa. April 7, 2006 */ Let( string = Case ( charsNumber > 0; chars & FixedLength ("" ; chars; charsNumber - 1 ; ""); "" ); Case( align = "Left" or align = "";Left ( text & string ; charsNumber ); align = "Right"; Right ( string & text ; charsNumber); string ) ) |
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests