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

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

Recommended Posts

Posted

I am learning FMPro 6 on Mac OS X and using the Product Catalog sample that came with the software to see how things work.

I want to only display certain Keywords from the external Keywords file when certain text is found in the Description text field (another field in the Product Catalog file). For example, if "DVD" is in the description, I want a subset of certain keywords to show, but if "CD" is in the description, I want a different subset, even though *all* keywords are in this single, external Keywords file (I guess if DVD and CD are both in the Description field, then both sets of keywords should appear, but should not be duplicated).

Any ideas?

I think if I could use a script in place of a field in FMPro, I would be much happier, but the scripting seems limited, or at least the built-in interface is totally foreign to me. I'm thinking that an if/then is appropriate, but how? The current "Keywords button" has as its script is:

Perform Script [sub-scripts, External: "Keywords"]

...and I see no way to edit this as needed?

Perhaps the "Keyword Field Button" script in the Keywords file? If so, how?

Posted

Dabbler:

You can do this using scripts but it is much easier to use a relationship between the two files.

In the second one, assign a unique key to each of the keyword sets (something like "TheKey1" and "TheKey2". Then create a calculation text field on the file 1, with something like this:

Case(

PatternCount ("TheFieldToSearch", "CD") = 1, "TheKey1",

PatternCount ("TheFieldToSearch", "DVD") = 1, "TheKey2"

)

This instruction will search a field for specifics strings of characters, if one of them is found, the calculation will return a 1 and will place the text "TheKey#" on the field. Create a relationship between both files using the calculation in the first and the unique key in the second (Make sure they are indexed fields). Finnally, put a field in the layout of the first file, referencing the keywords on the second one using the relationship. Sorry for the rough explanation, but I know it is one of the many solutions you can use.

Posted

That sounds good, especially since I think it is the way the these sample files are setup, even though I found what seems to be a script unless relationships make some scripts as part if their setup and that is what I found?

I don't suppose there is an easy way to do this without breaking the current Product Catalog sample, if you have (and know what I mean) in your copy of FMPro? I am not sure I won't break something else, but it sounds like I'll need to repalce this field anyway, with my own and as part of the new relationship you described...

I was trying to keep it intact and just edit it slightly to see what would happen and how it was working. I guess breaking it is one sure way to learn!

grin.gif

Thanks!

Posted

FMPro 6 for Mac OS X (std. retail, not server or dev or anything).

I zip'ed the sample (I call it "Media Collection" and changed a field to be called "Type" and set it as radio buttons, so that's the key for the keywords). You can see what I mean from these, if you don't have the Product Catalog sample in your Dev. version.

MediaCollection.zip

Posted

Did you see the attached files?

I think I finally narrowed it to the script within the "Product Catalog.fp5" file, called "Update Value List" and now I need to replace the "Go to Field [select/Perform, "Keywords"]" line into a set of if/then's...how to do that? I'm definitely not used to this interface - I want to just type some lines of code directly!

Just thought I'd let you know and see if any of the 5 downloaders had any input...?

Thanks!

Posted

It looks like this script leads to a value list called "Keyword Choices" which just grabs them all, but I could change it to "only related values" which seems to force a relationship, which is where I get lost, even looking at the above idea. God, I want a text editor to just type some if/then code simply. What a mess for something so seemingly simple - ARGH!

Posted

I duplicated the "Keyword choices" value list to two distinct value lists "Music choices" and "Movie choices" (and renamed scripts that I copied and changed so that the old script should not be found) and changed any reference in other scripts to "Keyword choices" to an if/then, that basically is:

If ["GetField("Type") = "CD""]

SetField ["Scratch Text", "ValueListItems(Status(CurentFIleName), "Music choices")"]

Else

SetField ["Scratch Text", "ValueListItems(Status(CurentFIleName), "Movie choices")"]

End If

...yet somehow this does absolutely nothing different at all?!

The two scripts I changed were "Update Value List" and "Remove Keywords in Scratch From Found Set" - am I missing something here (see attached/uploaded)? I don't see anything else that would/should be relevant...

MediaCollection.zip

  • 3 weeks later...
Posted

Does no one have this file? If so, see the attachment above.

Can anyone tell me how this sample is currently working?

If I have found the script it is using, why don't my changes above work?

It's the Product Catalog sample that comes with FMPro 6...should be easy to figure out, but apparently not?

To be honest, I have no idea what MikePR is talking about re: relationships to even hazard an attempt?

Posted

You need to categorize the key words by type. See attached for a modified version of your sample. Each key word is categorized as either Movie or Music. A calculation in the Product Catalog file categorizes CDs as Music and all else as Movie. Then a relationship from that field to the Type field in Keywords allows you to create a conditional value list displaying either all keywords related to Music or all keywords related to Movie, depending on whether CD or something else is selected.

MediaCollection.zip

  • 2 weeks later...
Posted

Ah-ha!

I see you added the field to each (Type and c.Type), then created a value list and a relationship.

I'm not sure why my explicit value lists attempt did not work as intended, but your relationship/value list solution makes sense.

I also see the Case() calculation for c.type says that if CD then music, else movie - that's the "if/then" logic I was looking for in scripting, but it happens in the field definition instead. That's what MikePR was getting at about relationships, and his "FieldToSearch" piece in his example!

Thanks a bunch! Now for the fun part - populating it...!

crazy.gif

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