Neuronal Nerd Posted April 25, 2009 Posted April 25, 2009 I want to create a list of layouts, but not all of my layouts. I'm sure this is relatively simple, but I'm having trouble figuring it out. Let's say I have Layout A through Layout Z, but I just want to pull Layouts between B and F. I know that I can use LayoutNames(Get(Filename)) to create a list of all of them, but how could I use the text functions to pull what I want? Thank you.
comment Posted April 25, 2009 Posted April 25, 2009 This is a recursive calculation, so you will need a custom function - perhaps something like: ValuesStartingWith ( listOfValues ; startChar ; endChar ) Let ( [ item = GetValue ( listOfValues ; 1 ) ; char = Left ( item ; 1 ) ; countValues = ValueCount ( listOfValues ) ] ; Case ( startChar ≤ char and char ≤ endChar ; item & ¶ ) & Case ( countValues > 1 ; ValuesStartingWith ( RightValues ( listOfValues ; countValues -1 ) ; startChar ; endChar ) ) )
Neuronal Nerd Posted April 25, 2009 Author Posted April 25, 2009 Thanks, but I tried creating that and the computer gives an error that a parameter cannot be found (highlighting the "char and char"), which I'm guessing it does not understand "item". So what would go there?
Neuronal Nerd Posted April 25, 2009 Author Posted April 25, 2009 Well, I thought I did. I've created simple ones before. I created a custom function with the exact name and parameters as your post. I cut and pasted your exact text for the calculation. I go to click Ok, and I get the error message I mentioned.
Neuronal Nerd Posted April 25, 2009 Author Posted April 25, 2009 I did miss the fact that item was defined already above in my haste, but I still don't understand why I'm getting "The specified parameter cannot be found" when it is highlighting "char and char"
comment Posted April 25, 2009 Posted April 25, 2009 Me neither. Why don't you post a screen shot of the entire 'Edit Custom Function' window?
Neuronal Nerd Posted April 25, 2009 Author Posted April 25, 2009 ok, I got it to work. Here is exactly what I did. I deleted the space before the word "and" and the space after the word "and", then I typed those two spaces back in manually. So seems to me there was some hidden characters/formatting when I cut and pasted that messed it up. That is over my head, but it's what worked.
Neuronal Nerd Posted April 25, 2009 Author Posted April 25, 2009 So, I've implemented the above custom function and the list it is returning includes all of my layouts except the one that is used for the parameter "startChar".
Neuronal Nerd Posted April 25, 2009 Author Posted April 25, 2009 Here is an example file of what I'm trying to accomplish and I've included the above custom function. Thanks for all help! LayoutList.fp7.zip
comment Posted April 25, 2009 Posted April 25, 2009 This is a different situation, since now you want values between "LayoutB" and "LayoutF", not between B and F. However, it's easy to generalize the function, so try: ValuesInRange ( listOfValues ; lowLimit ; highLimit ) Let ( [ item = GetValue ( listOfValues ; 1 ) ; countValues = ValueCount ( listOfValues ) ] ; Case ( lowLimit ≤ item and item ≤ highLimit ; item & ¶ ) & Case ( countValues > 1 ; ValuesInRange ( RightValues ( listOfValues ; countValues -1 ) ; lowLimit ; highLimit ) ) )
Neuronal Nerd Posted April 25, 2009 Author Posted April 25, 2009 Thanks again! Ok, so it works in my example solution, but when I go to implement in my actual solution, I run into problems. It may be related to my naming convention as I uses spaces, [ ], and - in my actual solution because I am getting incomplete results.
Neuronal Nerd Posted April 25, 2009 Author Posted April 25, 2009 (edited) I'm attaching another example file that uses some of the same naming conventions of my actual file. Please note there are items in the list that should not be in the list. LayoutList.fp7.zip Edited April 25, 2009 by Guest
Neuronal Nerd Posted April 25, 2009 Author Posted April 25, 2009 (edited) oh! I just realized what the computer is doing, though I still don't know how to fix it. It is giving me the layouts that are in between the 2 alphabetically. I don't organize my layouts alphabetically. I apparently chose a poor example and miscommunicated my intent. Here is another example. If I have the following layouts: Splash Screen Background Insurance Accounts Clinical Findings Recommendations Settings How do I get the computer to give me this list by telling it my list starts after "Splash Screen" and Ends before "Settings": Insurance Accounts Clinical Findings Recommendations Edited April 25, 2009 by Guest
comment Posted April 25, 2009 Posted April 25, 2009 You would need another custom function to sort the result. You could search Brian Dunning's site for likely candidates. Why do you need this, BTW?
Neuronal Nerd Posted April 25, 2009 Author Posted April 25, 2009 I have over 100 layouts in my solution. Among those layouts is a list of about 20 different clinical tests, each with its own layout for data entry. I group those layouts together. Every time I add a new test to my research, I wanted my field that lists the available tests to automatically update based on the name of the layout.
comment Posted April 25, 2009 Posted April 25, 2009 That doesn't sound like a good arrangement. You should be able to add tests without modifying the schema at all.
Neuronal Nerd Posted April 25, 2009 Author Posted April 25, 2009 I found a custom function called GetIndex, and this ended up meeting my needs: MiddleValues ( LayoutNames(Get(FileName)) ; GetIndex(LayoutNames(Get(FileName));"TestListStart")+1; GetIndex(LayoutNames(Get(FileName));"TestListEnd")-GetIndex(LayoutNames(Get(FileName));"TestListStart")-1)
comment Posted April 25, 2009 Posted April 25, 2009 Oh, so that's what you wanted (I haven't seen your edit earlier). This could be done quite simply as: Let ( [ start = Position ( ¶ & listOfValues & ¶ ; ¶ & startValue & ¶ ; 1 ; 1 ) ; end = Position ( ¶ & listOfValues & ¶ ; ¶ & endValue & ¶ ; start ; 1 ) + Length ( endValue ) ] ; Middle ( listOfValues ; start ; end - start ) ) I still think your real issue is elsewhere.
Neuronal Nerd Posted April 25, 2009 Author Posted April 25, 2009 Please tell me more about my issues. Should I be using a different structure? I don't add tests often (about 2 a year), and I use the same tests over and over. I put each test in a different table because each is so incredibly diverse and within each tests, I use very different formulas for calculating standard scores and interpretations of those tests. I don't see it practical to have a single table with each record representing a different test because there are so many different things I would do with each test.
comment Posted April 25, 2009 Posted April 25, 2009 I have practically no information regarding what your tests are, but it sounds like you have a field for every parameter. I would have a table of tests, and another table for the test parameters, where each parameter would be a record. A third table would be used for the actual values and statistics. This is just the basics - it gets more complex depending on what/who you're testing, how often, etc. But the idea is to have a discrete record for each recorded value. This is the only way results can be be analyzed by any chosen criteria with no restrictions.
Neuronal Nerd Posted April 25, 2009 Author Posted April 25, 2009 I follow your logic, but the only analyses that I'll ever need to do are already being done with my current structure.
comment Posted April 25, 2009 Posted April 25, 2009 OK, then. I just wanted to point out that the 100+ layouts, the current issue, and the fact that you need to put on your developer hat to do things that should be entirely in the province of the user - these are all just symptoms of a structural issue. But if it works...
Mike J Posted April 27, 2009 Posted April 27, 2009 Hi Comment, Would you mind exanding on the structure you suggested? Test table Results table Analysis Table? How would a results table allow for the programmer to define analysis for different tests? (Table names just a guess towards your structure suggestion?) Thanks Mike
comment Posted April 27, 2009 Posted April 27, 2009 Would you mind exanding on the structure you suggested? Rather difficult to do without a mission statement. My point here was that when you have a separate record for each result, you can easily produce a report by any criteria (e.g. patients with low cholesterol and high blood pressure, grouped by ethnicity). Do a search for "survey" for more examples.
Recommended Posts
This topic is 5748 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