Jump to content
Server Maintenance This Week. ×

Removing and Retaining Lines from a Multi-Line Field based on a Keyword


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

Recommended Posts

Hello everyone,

I've got a problem for which I've not been able to find any answer. I'd like to take the output from

TableNames(Get(FileName))
 and exclude any table names that have a particular keyword at the beginning of their name (e.g., "Hidden"). Then, I'd like to take the output from 
FieldNames(Get([the table name that a user selected from TableNames(Get(FileName)), passed to a variable])

and only display the fields that have a particular prefix (e.g., "Show"). I can figure out how, using Substitute, to search for and erase the TableName keywords themselves, but I can't figure out whether there's a way to have FileMaker search for the keyword and delete that and the rest of the line each time the keyword comes up. I also am not sure how to display only the fieldnames that have the correct prefix. Might any of you know how to accomplish this?

Thank you very much!

My best,

J.L.

FileMaker Pro 11, OSX and Windows XP

Link to comment
Share on other sites

exclude any table names that have a particular keyword at the beginning of their name (e.g., "Hidden").

You have tables named "Hidden Something"?!

Anyway, to remove values that begin with "Hidden" from a list of values, try =

FilterValues ( listOfValues ; Substitute ( ¶ & listOfValues ; "¶Hidden" ; ¶ ) ) 




Note that this is case-sensitive, because Substitute() is.





To do the opposite, i.e. keep values that begin with "Hidden", try =




FilterValues ( 

listOfValues ; 

Substitute ( ¶ & listOfValues ; [ "¶Hidden" ; "§" ] ; [ ¶ ; "¶±" ] ; [ "§" ; "¶Hidden" ] ) 

)

Link to comment
Share on other sites

Comment,

Those both work perfectly. Thank you very much! I doubt that I could have figured those out lacking your help!

Ha, I am, indeed, considering naming some of my tables "Hidden..." My supervisor, who does not deal with databases, is insistent that I be able to produce metrics based on the data that I'm keeping; I never know, however what those "metrics" might be until the day I'm asked. Rather than coding, in advance, every possible contingency for charting my data, I've decided to experiment with building a more dynamic charting system: with the relationships already in place, a script will display the available tables from which to get data, and I'll choose a table; then the script will show me available fields, and I'll choose one for the X axis and one for the Y axis; then the script will open the Manage Layouts window, and I'll switch the table with which my (single, centralized) charting layout is associated; and viola. My charts draw their X- and Y-axis field names from global variables that are set in the script steps above, so by setting things up this way, I should be able to use a single layout to chart any data I want. It's not an ideal solution, but seems the best way to go for now, since the expectations of my supervisor are not clear. And including a "Hidden" prefix at the beginning of some table and field names might simplify the process when I have to choose tables and fields.

Again, thank you!

Link to comment
Share on other sites

Comment et al.,

I just figured out that fieldnames() returns only the fields on a particular layout. Is it possible to get a list of all fields in the layout'stable (regardless of presence on a layout)?

Thank you very much!

My best,

J.L.

Link to comment
Share on other sites

This topic is 4762 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.