Neuronal Nerd Posted April 25, 2008 Posted April 25, 2008 (edited) I am trying to create tables via a calculation for use in a text field. For instance, lets say I have 6 fields (Test1, Test2, Test3, Score1, Score2, and Score3). The "Test" fields are the names of different psychological tests that I use. The "Score" fields are actual scores. I would like the text calculation to result in an evenly spaced table: Test1 Score1 Test2 Score2 Test3 Score3 However, given that I want the user to be able to use non-fixed width fonts and the actual length of each test name will vary, is there a way that I can get these tables spaced correctly? I guess what I really need to know is there a way to calculate the actual length of a given text in some unit (i.e., inches, pixels, etc) other than the number of text characters. Although advice on work-arounds are welcome, I've already considered using different columns and having these line up on a layout, but I really need this to be done via a text calculation the way my solution is set up. Thank ahead for all advice! Edited April 25, 2008 by Guest
Neuronal Nerd Posted April 25, 2008 Author Posted April 25, 2008 By the way, I'm pretty sure that what I'm asking isn't possible, but I would like an experienced user to tell me that so I can quit trying to figure it out.
mr_vodka Posted April 25, 2008 Posted April 25, 2008 I dont think that there is a way to do this without using a monospaced font, and since you already said that you were not going to be doing that, I believe there lies your answer. What is the purpose of this that you can not do with a layout or portal?
Neuronal Nerd Posted April 25, 2008 Author Posted April 25, 2008 Thanks for validating. As far as the purpose, the solution is taking a whole lot of scores from tests and demographic factors and creating interpretive reports that all feed into a single text box. The reason I have a lot of different text calculations feeding into a single text is so that the user experience is close to that of a word-processor. In other words, the user enters in some scores, checks a couple of boxes for demographic factors, and then they have their report half written already on a layout that resembles popular word processors. I've taken the time to create features that mimic a lot of those features from word processor (e.g., bold, italic, different fonts, sizes, etc.). I've tried exporting to other applications such as Microsoft Word, but I still run into the same spacing problems. I've used Ezxslt in the past to export to a word file, but I don't think that my average user would want to set up those templates.
Ted S Posted April 25, 2008 Posted April 25, 2008 Just kinda thinking out loud here but perhaps you could write the data to a table within an HTML file and then show the results in the webviewer.
Neuronal Nerd Posted April 25, 2008 Author Posted April 25, 2008 I know less about HTML than I do filemaker : But I am willing to learn. I'll look into that. Do you know of any example files that does something similar?
Neuronal Nerd Posted April 25, 2008 Author Posted April 25, 2008 Just thinking aloud myself, what if I manually measured the width of each letter for a few of the most common fonts that I use, and assign a relative value to that letter based on how wide it is. I could then add up those values based the text in the fields and come up with a measurement for the actual width of a given text. I would probably do this in a custom function and it would be a bit tedious, but it may be worth it in the long run. Does this sound feasible (before I put the time into it)?
comment Posted April 25, 2008 Posted April 25, 2008 I'm pretty sure that what I'm asking isn't possible You need to clarify why this needs to be done with a calculation, and more importantly - what would be the result of such calculation. Obviously, any calculation resulting in number of spaces to insert would be dependent on a specific font at a specific size (and would render differently on Mac and Windows). The simplest way to have such table on a layout is to type the following on the layout: <>TAB<>¶ <>TAB<>¶ <>TAB<> and align your tabs to accommodate the longest expected value.
Neuronal Nerd Posted April 25, 2008 Author Posted April 25, 2008 (edited) Hi Comment, The reason that I want to do it in a calculation is because I sometime have scores automatically flagged if they are worse than others. I also use the calculations to filter exactly which tests scores will be reported as I give different combinations of different subtests even within the same test batteries. So I'm trying to put together a custom function that tabs over like you have suggested. Of course the problem I run into is that the field Test1 may have a short value ("LNNB-C") where as the field Test2 may have a long value ("Luria-Nebraska Neuropsychological Battery-Form II"). So a single Tab does not do the trick. I'm assuming there is a way making an inverse calculation to accomplish this, but I need some help here: I stored an actual Tab in a custom function called tab. I then do calculation something like this: Let($Space=(Max(Length(Test1); Length(Test2); Length(Test3); Test1&[color:red].....&Score1& Test2&[color:red].....&Score2& Test3&[color:red].....&Score3) So what could I put in the [color:red]..... part to get the spacing correct? Edited April 25, 2008 by Guest
Fenton Posted April 25, 2008 Posted April 25, 2008 As comment says, you can use tabs. It is surprising that many FileMaker users do not seem to know that FileMaker has decent (though basic) word-processing abilities. Tabs can be left, right, or decimal aligned. They can be added either to a block of text in Layout mode, or within a field in Browse mode. They are accessible via the Format, Text command, Paragraph button, and visible via the View, Text Ruler. The various buttons in the dialog are a little confusing, but they are in word-processors also :-]
comment Posted April 25, 2008 Posted April 25, 2008 So what could I put in the ..... part to get the spacing correct? A tab character. This would work exactly like in a word processor. You just need to position your tab close to the field's right margin, and make the field wide enough to accommodate "Luria-Nebraska Neuropsychological Battery-Form II" and its score.
Neuronal Nerd Posted April 25, 2008 Author Posted April 25, 2008 I'm sorry, but I'm confused. How do I position a tab to the right margin via a calculation? In my previous post, I was attempting to find a way to insert varying of number of tabs based on a calculation.
Neuronal Nerd Posted April 25, 2008 Author Posted April 25, 2008 Here is an example as to how far I've gotten so far. Please note I'm using a custom function to store a Tab. The problem with my current method is that I'm sure that I'm guessing there is a better way to do the calculating using the Max function to find the longest test name and use that to calculate the number of tabs. Please see the attached... Test.fp7.zip
comment Posted April 25, 2008 Posted April 25, 2008 How do I position a tab to the right margin via a calculation? You position your tabs by formatting the field, not via a calculation. Select the field in Layout mode, and choose Format > Text... > Paragraph... > Tabs... See the attached for an example. This is a bit tricky, because you have to do this "blind". It's much easier with merged fields, because you can see and use the text ruler - see: http://www.fmforums.com/forum/showpost.php?post/263664/ Tabs.fp7.zip
Neuronal Nerd Posted April 25, 2008 Author Posted April 25, 2008 Wow! I get it now. I think that despite 20 years of using word processors, I never understood tabs thoroughly. I'm testing this right now in my bigger solution. Even though I've learned something, it still may not work based on how my other solution is set up because I have many other fields being fed in the one field via an auto-enter that the user ends up editing as a final document. That one field is ends up having several pages worth of text with the tables sometimes being in the middle of all of that. So if I'm messing with tabs, I needs to see how that throws off other things. Thanks for the help!
comment Posted April 25, 2008 Posted April 25, 2008 Well, there's another issue here which I didn't bring up until now so as not to confuse the matter. But your structure is wrong. You should have a separate table for the tests and their scores, and use this table for printing your report. I don't know what other information you have, but it looks like the test name and score should be in the body, and the rest of the stuff in various sub-summary parts. This way you'd select which tests to include by finding them, not by calculation. I suspect a lot of things may become easier, once you set up your structure correctly.
Neuronal Nerd Posted April 25, 2008 Author Posted April 25, 2008 I think I follow your logic, but I've added more to this layout to show how I would like the user to experience. I think I couldn't have the same end user experience if I structured it differently. Test-1.fp7.zip
Neuronal Nerd Posted April 25, 2008 Author Posted April 25, 2008 I should probably elaborate more on my structure and the rationale so that this makes more sense. My solution is way too big to post, but in it, I have several tables that feed into my "Report" table where the information is brought together, including Tables for Tests and their scores, patient contact info, insurance info, lab results, scheduling dates. The layout seen here is just where all that information comes together via one huge calculation based on many relationships. The idea here is to maximize the doctor's time. In other words, the secretary has already entered in information such as name and date of birth when the patient walked through the door...the intern or technician has already entered in test scores after they finished administering the tests...the biller has already entered in insurance info...the doctor has already typed up the patient's history from an interview. The information needs to be pulled together for one long comprehensive report.
Recommended Posts
This topic is 6116 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now