Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6710 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

I have a global repeating field where users can insert values that I then need to search and find. These values come from a list of values one of three variables and represent a value from that variable. I would like to write a dynamic script so that I can go down the global repeating field and find each example of the variable from the source. Only one variable is being used. I want to script in a way to tell which one it is, and then search on the values requested. Here is an example.

dosage form variable global repeating field

a b b c d

d

drug category variable global repeating field

r r

s t t u u

disease category variable global repeating field

v y

w

x

y

z

In the first example, the user is inserting values from the dosage form variable and I need to search for values of 'b' and 'd'. The second example, the user selects values from the drug category variable, and I need to search for the values r, t, and u. Note that the user may only select one of the variables to use.

I have three separate layouts for these finds.

After I search for a value on the variable, a certain number of the found records will be marked, and then find the next set of records with the next value on the variable, mark a certain number of records, etc.

Is there a way to script this dynamically so that I write one script and it engages on any of the three layouts to find records according to the values of the variable for that layout?

Thanks for considering my problem!

Edited by Guest
Posted

It isn't that obvious what you're asking for, but here's a snip of script to turn the content of a 10 rows repeating global into 10 requests for an OR'ed search:

Enter Find Mode [ ]

Loop

Set Field [ pling::aField; pling::g_repeat[Get ( FoundCount )] ]

Exit Loop If [ Get ( FoundCount ) = 10 ]

New Record/Request

End Loop

Perform Find [ ]

--sd

Posted

SD provides an excellent example and I only am adding onto this because I already have an example file that demonstrates the same technique. The only difference is that it grabs the new requests from a return-separated list. Anyhow, thought it might help. It's included in my DevCon 2004 presentation in the scripting section using a file called NEWREQ.FP7. You can download the presentation from my web site:

http://www.filemakerpros.com/DevCon2004.zip

Posted

Thanks for the replies. I did look on your site, John Mark, but didn't see that particular file. I am digesting it, and not getting things to work quite yet.

Soren, it's not an 'or' find, rather a serial find--after finding the first item in the global field, I want to do some things to those records before I move on and find the next item in the global list.

Here's the big picture. User wants to create a set of records (prescriptions) chosen by a parameter (say dosage form). User wants a total of 10 records (prescriptions). Of these 10 records, user wants 3 which are capsules, 2 which are tablets, 3 which are suppositories, and 2 which are creams. User selects 'capsules, tablets, suppositories, and creams into the global repeating field and next to each, in another repeating field, are the numbers 3, 2, 3, 2 corresponding. Conceptually, I find all capsule prescriptions, assign a random number, sort by the random number, and mark the first three records; next I find all the tablet prescriptions, assign a random number, sort by the random number, and mark the first two records. Etc. After marking all the appropriate records, I find all the marked records, and export those for use in another file.

The values being entered into the global as search terms come from a portal of values in another table. This brought to my head John Mark's admonition to script dynamically so it wouldn't matter how the values in the other table change, yet once the user selected which ones into a global field, the script would run down it doing its thing.

I hope this clarifies my issues. I'll keep noodling on what you've provided, but if you have further thoughts, I'd appreciate it.

Posted

Sorry, John Mark, I meant to say I had looked at your site prior to my first posting. I did download from your link and am playing with it now.

Posted (edited)

I'm not getting into the details of your post yet, but it seems like you should structure this series of searches this way:

First image is how to accomplish things under fm8

Next image is how to avoid using globals, recursive script!

Well I've just noticed that you're using FM7 so $variables are not yet availiable, but you could use a global number field where write "Set Variable" and change it to Set Field[ just remember to make it a global!!

A more crafty, but very unreadable method is to make a recursive script taking care of the counting:

--sd

Billede_4.jpg

Billede_3.jpg

Edited by Guest
Found the readbility needed something
Posted

Soren,

Thanks for your ideas. I'll study these and see if I can make it work. By the way, I am using FMP 8 Advanced and OS Tiger, I just haven't been able to get the profile info to change.

As I've been working on this, I've wondered if there is a function which returns how many entries in a repeating field, i.e. if a 26-repeating variable only has 5 entries, then I need to do five find 'cycles'.

Posted

You have consider, that users might leave empty repetitions, it's actually a weakness in your choise repeating fields. Where Johns return delimited list, much more easy can be transformed to one single chunk of data to process ...simply by getting rid of where more than one ¶ meets a fellow ¶....

Can be done by this CF:

http://www.briandunning.com/cf/495

--sd

Posted

I agree, but the choices are coming from a portal where the user can pick which he wants, and yes, there will be lots of empties.

I have 'hardwired' scripts in which I detail all the possible values, but was hoping not to have to do that for these other choices,especially as there will likely be additions to them, which would mean writing new script.

I will keep working! Thanks for your help!

Posted

I agree, but the choices are coming from a portal where the user can pick which he wants, and yes, there will be lots of empties.

What the.... Sorry - are you telling me that you let the user click on lines in a portal, for stuffing something in various repetitions of your global requestholder?? This is definately a one-nil to a global textfield as approach, next issue is how would you avoid searching for the same this twice??

Hopefully are you aware of, that if a portal value is relationally linked to fields one relation further away, is a single GTRR step all it takes to go to the found set matching??

The invisible button in each portal row examine what already is entered in the global textfield (please note that a $variable, actually all it takes!) by a combination of PatternCount and Substitute( or this set and forget blackbox'ish approach:

http://www.briandunning.com/cf/39

Now $variables can only be seen via tooltips, so this speaks in favour of the global field... perhaps you should see this in action:

http://www.fmforums.com/forum/attachment.php?attid/7871/

In the template does the line colour follow a value in each line, but you could make the bar come and go by making a patterncount of the value a relation away, in say the global field!

BTW one more thing that talks in favour of the global textfield, is that the upper limits is 2G and not as with the repeating field the number of defined slots.

--sd

Posted

Hi Pat,

You could use the Last(field) function to get the value of the last non-blank repetion. Then use it as a test on each loop pass.

HTH

Tim

Posted

You could use the Last(field) function to get the value of the last non-blank repetion. Then use it as a test on each loop pass.

Indeed with the risk that this last is a dupe, say the first and the last are duplicates!!!!

Ditch repeaters!!!

--sd

Posted

Soren,

I have a TOG of prescriptions, a TOG of drugs, a TOG of drugcategories. When the user composes a prescription, he chooses a drug product which has been assigned a drugcategory ID, a dosage form is assigned, and a disease state and disease category.

On the find page, I want the user to be able to see all the possible drug categories from which to pick (or disease categories, or dosage forms. Bear in mind the user can only pick based on one of these, not all of them.) That's why I use the portal to show all the values (records) from the drug category table. The user clicks on the list, going down the ones he wants, and the value gets put into the global repeating textfield, constructing the list he wishes to have. I wanted the user to be able to choose all of that up front and then have the computer do the work behind the scenes. A user might want, for example, to pick a total of 20 prescriptions which contains maybe 8 different drugcategories in varing numbers (up to 20 total).

Forgive my stupid question (I'm a teacher who believes there is no such, here's hoping you do too!) What is this $variable you keep referring to?

I admit I haven't had time to digest your last suggestion as I'm attending a conference and I snatch time on this program as I can. I do appreciate all the thought you've put into this.

Posted

Let me also add that the list is not likely to contain any duplicates as the user can see which items are being selected, and there would be no purpose to selecting the same category twice.

This does bring up a whole different problem I have that I haven't been able to fix--duplicate drugs, for example out of the 20 presciptions desired, having more than one be the same drug entity. Instructors generally would prefer students get a variety rather than two different prescriptions for the same drug. I thought I had it figured out, but find it didn't. Is there any way to check during the record finding process, whether duplicates have been marked?

Posted

TOG of prescriptions, a TOG of drugs, a TOG of drugcategories.

An anchor buoy approach or :) How are these groups build? This is not concise information, it's similar to me telling you how many bricks my house consists of - Chances are that you mean tables instead ...but even so is there a referential integrity problem with a table for both a table of drugs and drugs categories, it's not clear for me why this has to be two tables??

You need as well to tell me what kind of processing a found set recieves?

In short aren't you giving too much away, so you must excuse me for this stab in the dark ...which might be inspirering if my guess that the tree tables or even TOG's is slightly overkill:

http://www.fmforums.com/forum/attachment.php?attid/3285/

--sd

Posted

I have never really seen the light in the searches you wish to make, why not enter the items straight into the join table, instead of going to make searches, by making filtering of the portal that contains the drugs, I have only in my template made one category but there can easily be made another popup with all the forms the drugs arrives in, fluids tablets etc.

I stand a chance with your declared skill level to make too hasty conclutions on what you're missing here, but since you reach out for repeaters doesn't it seem like you're fully drilled in relational approaches ...and I do deeply appologize if the simplicity in my template offend you.

My scripts have no searches what so ever!!!

--sd

Pharmacy.zip

Posted

Soren,

Thanks for the files. I am looking into them and dissecting them. I am far from offended. I worry more about my offending someone who is trying to be so helpful! As to my designation, I'm not sure what the differences are between beginner and intermediate. I've been at this for a while, and obviously know enough to get myself into the deep end. Most of what I know is self study, and that goes slow. I do enjoy DevCon for what I can pick up there.

Thanks!

Posted

I do enjoy DevCon for what I can pick up there.

I attended Devcon last summer, and due to the way I'm hired weren't the revalations of fm8 not exactly news ...beyond that was this Devcon neither high octane intellectual input nor completely irrelevant. I would dare say that you can't really sharpen your developer skils by attending ...mainly because the aim is different: SPIN!

It's an efford to do two things, evangelizing that it's the right horse you have put your money on, and secondly to ensure against ill reputing deployment, occures too often. It's done by letting the "doctors" meet each other and exchange recipees and cures in a highly fragmented and random way ...which only by chance could be accepted as "knowledge" if scrutinized.

--sd

Posted

What would you recommend for deeper learning? (Just got back from my conference.)

Depending on what you would like to be good at?? If you wish to persuit the devcon'ish track is it going to be - Dilbert and Machiavelli ???

If it's to get a mindset for troubleshooting filemaker developement issues, is it going to be:

http://www.foundationdbs.com/Downloads/WhitePaperForFMPNovices.pdf

as well as:

http://www.foundationdbs.com/Downloads/WhitePaperForFMPNovices.pdf

But they're not nearly enough if you wish to learn how to get the relations right - Normalization is founded in Sets theory and predicate logic wich both are mathematical disciplines, which perhaps not is as present as it should be?

I would gladly admit to my shortcommings in that direction, but it can be remedied otherwise by following this method strictly:

http://www.formeremortals.com/

It's not written to a specific Filemaker'ish audience, but perhaps where it's real strenght is?

--sd

This topic is 6710 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.