I'm sure you'll soon get some top-notch suggestions on this. In the meantime, I'd like to ask you a couple of questions to really hone in on the desired behavior.
Given your example of having the following:
Questions for you:
1) Do you expect an input such as "eva" to be able to find and delete a value such as "oneValue" or "threeValue", or is there no requirement for doing a search where the search string starts in the middle of the target value?
2) Given the input of "t", what is the desired outcome:
- Delete just one of the matched values, e.g. "twoValue" ?
- Delete all of the matched values, i.e. "twoValue" and "threeValue"?
- Something else?
HTH & best,
Message was edited by: steve_ssh
Corrected mistake in question 1: Had typed "twoValue" when I should have typed "threeValue".
Hello Again Mike,
It turns out that I had a parsing function lying around that does stuff very close to your large goal of modifying a list of values.
I will attach a file that illustrates its use.
I've little doubt that someone will think of something more elegant/efficient, but perhaps this will be of some use in the meantime.
Details from the CF comments are below.
HTH & Best,
Accepts input which is a set of lines of text.
Returns a modified subset of lines, omitting either matched or unmatched values, depending on use.
Matches are case-insensitive, and performed against each line by comparing the line to a supplied search string.
Matches can be optionally constrained to matching only if the match string appears at the start of the target line.
Leading match strings can be optionally stripped from returned lines. I have found this to be helpful in building some crude HTML parsing routines.
Empty lines are never included in function output.
ParseMatchingLines( LineData; MatchString; MatchOnlyFromStart; StripLeadingMatchStrings; OmitMatches )
Explanation of Parameters:
LineData: A string of return-delimited/line-feed-delimited text to search through.
MatchString: Case-Insensitive string to search for in each line.
MatchOnlyFromStart: Set to True to find only lines which *begin with* MatchString.
StripLeadingMatchStrings: Set to True to strip the leading MatchString from returned lines. Otherwise set to False.
OmitMatches: Set to True to return only lines which do *not* match. Set to False to return only lines which *do* match.
LineMatch_01.zip 71.5 K
Thanks for both your responses - I just made it back to the thread.
I will check into your CF file there and see if that will work. I need to look a little closer at it tonight, but from the description it sounds like it would do what I would want!
As for your first reply and the questions - I guess if I was making a more "reusable" custom function I could better answer that. Right now, its being designed for a specific purpose, so it doesnt have to be all that flexible. In my case, I already know that the first digits of the string will always be a primary key of a few numbers, and the script will always know the primary key it is searching for - it just doesnt know what comes after that.
So a standard string of the text would be something like this (there would be a bunch of these seperated by carriage returns):
I know the primary key, but I need to find the equipment ID and type of equipment. And I also need to be able to delete the whole thing which is what I am trying to sort out right now.
Basically, I need a list of all the related equipment records, that are related to my one "room" table record at all times. I first thought I might do a summary field showing related equipment with counts, but I need to know how many of each type of equipment as well, and there are several different kinds. I didnt want to create 10 different summary fields to add up how many of each type of equipment is in the room, so I thought I would just have one field, which holds a list of all the equipment.
That is what I am trying to achieve.. Hopefully that didnt make it more confusing.
Basically, I need a list of all the related equipment records, that are related to my one "room" table record at all times. I first thought I might do a summary field showing related equipment with counts, but I need to know how many of each type of equipment as well, and there are several different kinds. I didnt want to create 10 different summary fields to add up how many of each type of equipment is in the room,
That is not how summaries work; you have one summary field that does the aggregating for each of many groups.
You can do all this with the usual tools, and even some unusual ones; but a recursive CF isn't really necessary.
(And you can see why it is usually better to describe what you want to achieve, and not what may be wrong with some particular method.)
See if the attached file helps.
CountEquipment_eos.fmp12.zip 70.8 K
Thanks for the reply erolst,
Sorry for not being more clear at the start, I am just trying to prevent asking someone to do all the work for me and be more specific in my requests, but I can see there may be another way to acheive what I am looking for.
Thank you for the demo file I will take a look.
Thank you for posting more info. Though I don't understand the requirements 100%, you made things more clear by posting what you did.
I seems as though you are going down the path of creating db table-like functionality with a CF because using actual db table(s) and schema did not seem workable.
If this is the case:
I'd suggest that you start a post describing your system's requirements, and see if anyone suggests a good design that does not require you to implement your own table-like functionality via a delimited list.
Someone may suggest something that suddenly makes it all seem much more workable in an elegant fashion that uses standard FM table/relationship functionality.
If you can go the route of using FM's built in db abilities, rather than implementing your own, your project will probably benefit in the long term by having greater scalability and maintainability.
Having said the above:
I'd like to applaud you for being resourceful and figuring out your current scheme. I think that's great, and a great way to learn.
And, it still may be among the most viable solutions, but I think it's definitely worth soliciting some other suggestions before deciding whether or not that is the case.
HTH & very best,
Message was edited by: steve_ssh
Case in point: erolst's post -- I did not see it when I posted this message.
Based on your reply and Erolst, there is probably a better way to do this - though I should say that your CF you posted actually works perfectly for what I had invisioned!
So here is my scenario - again I feel almost like cheating for just posting this and asking for step by step instructions but if you are willing to help then I cant pass that up
My filemaker table set up is ROOM ----< Equipment
Thats it! Here is a picture of my work in progress webviewer if that helps visualize it:
Message was edited by: madmike6537
a list of all the equipment that is in my related equipment table, and I need to know what type of equipment it is, and the ID number for the equipment (these are both fields in the equipment table).
Sorry, no step-by-step …
As you can see from my sample file, you (probably) should have a structure like
Rooms R --< RoomEquipment RE >-- Equipment E
Now do you need a list of related entries from RE (i.e. every single piece of equipment in a room), or from E (i.e. every type of equipment used in that room)? Or both?
I would need both -
I need to know every peice of equipment in the room, its ID number, and its type.
I guess the part I am missing is how I read that as a list. Is that a summary field similar to your demo file then?
Well, in your Web Viewer calculation, declare some array variables like
Let ( [
listIDs = Substitute ( List ( RoomEquipment::id_equipment ) ; ¶ ; "," ) ;
listNames = "'" & Substitute ( List ( RoomEquipment::cEquipmentName ) ; ¶ ; "','" ) & "'" ;
listTypes = "'" & Substitute ( List ( RoomEquipment::cType ) ; ¶ ; "','" ) & "'" ;
listCoorX = Substitute ( List ( RoomEquipment::coordX ) ; ¶ ; "," ) ;
listCoorY = Substitute ( List ( RoomEquipment::coordY ) ; ¶ ; "," )
and insert them into the JS code.
And I still think you should have a three-table structure …
Hi Mike and erolst,
1) I agree with erolst about the three-table structure.
3) Even if there are safeguards to prevent missing values, I'd advocate for trying something like:
* or *
Hadn't thought about using execute SQL in a call field, that might just work I'll give it a try and report back.
Excellent! Glad to hear that you are working your way through it...