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

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

Recommended Posts

Posted

Hi,

I would like to create groups of records based on a specified search criteria of the contacts files we have...

I would then like to keep this "Group" as a named resource that can be used for marketing…..

The contacts files have various unique defined fields that would be the search criteria.

I have another table for the resulting "Marketing Group"

I am wondering where would you put the group identifier… in he contact record or put the contact record identifier in the "Marketing Group" Table...

we need to see from the contact which "Marketing Group's" it belongs to and from the "Marketing Group" which contacts belong to the group...

we will also want to collate metrics etc...

Thanks...

Posted

You should basically have a middle table for the relations between contacts and groups.

In this middle table, only 2 fields is needed (though others could be relevant)

KeyField_Contact

KeyField_Group

 

For each contact, that should be related to GroupA, you create a record in the middle table, with the id for the contact and for GroupA.

This can be scriptet..

Posted

Ah yes that is a great idea...

So I will create a button...

This will launch a window...

in it it will have search criteria from the contacts table and there will be an option to put in a name for the group…(required)

Then upon a create button being pressed ...

The group record will be created with the search criteria and name and a middle record will be created with the two fields...

We will be creating about 5 groups a week possibly...

Posted (edited)
I would like to create groups of records based on a specified search criteria of the contacts

 

It sounds like you want the contact's association with a group to be dynamic: for example, a group of contacts aged over 50 would automatically admit a contact born in 1963 sometime during this year. If that's the case, then there is no room for a join table - you need to store the criteria within the group record and use a relationship to identify the group members.

 

The other side of this coin is that it will be difficult to see which groups a contact belongs to when some of the criteria must rely on unstored calculations, such as the above example.

 

 

---

See also:

http://www.filemaker.com/12help/html/import_export.17.5.html#1051509

http://www.filemaker.com/12help/html/find_sort.5.20.html#1028826

Edited by comment
Posted

You should basically have a middle table for the relations between contacts and groups.

In this middle table, only 2 fields is needed (though others could be relevant)

KeyField_Contact

KeyField_Group

 

For each contact, that should be related to GroupA, you create a record in the middle table, with the id for the contact and for GroupA.

This can be scriptet..

 

 

can you give me a pointer ?

Basically I want to Create A "Marketing Group" from a  series of contacts and then view info about the group from the new Group record … i.e. show all contacts in group etc...

 

Posted

If I understand what you want, I would create a join table. A join table is used to join records between two tables, when e.g. a contact can be in many groups and a group can contain many contacts.

 

In the join table, two fields is needed; Contact_ID and Group_ID

 

A way of scripting when you want to add many contacts to the same group, is to loop through the contact records and create records for each in the join table.

It could look something like this:

 

Show Dialog ( Enter the Group ID for the group, that you want to add all found contacts to )    (this could be done more elegantly, but we need the group ID)

SetVariable ( $Group_ID ;   <-- ID of the choosen group --> )

GoTo Record (First)

Loop

SetVariable ( $Contact_ID ; List ( $Contact_ID ; Contact_ID )  )

GoTo Record ( Next ; Exit after Last )

End Loop

Go To Layout ( Join Table Layout )

SetVariable ( $count )

Loop

Exit Loop If ( $count > ValueCount ( $Contact_ID )

New Record

Set Field ( Contact_ID ; GetValue ( $Contact_ID ; $count )   )

Set Field ( Group_ID ; $Group_ID )

SetVariable ( $count ; $count+1 )

End Loop

Go To Layout ( Original )

 

 

On the Contact TO group, you create a TO with the join table and relate between the Contact_ID in the Contact TO and the Contact_ID in the join table. Then another TO from join table to a group TO.

Now you can create a portal, showing the records in the join table, that this contact is related to. With the relation to the group table, you will be able to show info from the group record.

The same can be done from the group record.

Posted
A way of scripting when you want to add many contacts to the same group, is to loop through the contact records and create records for each in the join table.

 

Or you could simply import the found set of Contacts into the join table, then do Replace Field Contents[] on the GroupID field.

Posted

SetVariable ( $count ) is a counter, that keeps track of how many records you create.

As "comment" has written, you could also accomplish this with Import records.

...however, I stopped using that pracsis years ago, since I don't find it reliably enough.... but thats just my experience...

Posted
...however, I stopped using that pracsis years ago, since I don't find it reliably enough.... but thats just my experience...

 

Oh, no... please, not yet another rumor.

Posted

What are you commenting on ??

...what I wrote, is not a rumor, it was, as stated, personal experience...

If you have another opinion, it is fine, then argue for that.

I clearly stated that it is my own opinion and experience, not to use import step...

Posted
...what I wrote, is not a rumor, it was, as stated, personal experience...

 

Is this experience repeatable? If yes, please post the exact steps to reproduce the problem. If not, then it's just a rumor. Over the years, I have encountered many such "helpful hints" circulating in the Filemaker community that turned out to be completely baseless. Usually they were the product of encountering a problem, bypassing it somehow, then drawing a wrong conclusion.

 

If it seems to you that I am coming on rather strongly on this issue, you are right. Like the person in the joke who was run over by a train, then viciously attacked a whistling kettle, I too believe that "you have to kill them while they're small".

Posted

"comment"

First of all, it seems like you are on a vendetta.. which seems very odd.

Second, it is very difficult to take this discussion or your last comment seriously, when your profile is annonymus.

 

The thread start asked a question, which I came with a suggestion to. So did you, and my only comment was that I have seem problems with the method you suggested, which was why I came with another solution.

Since I don't suspect that you invented the import function, your outburst just seems that more strange...

 

So for the above reason and the fact that this discussion has nothing to do with the question from the thread starter, I will leave this now.

Posted

I totally agree with comment on this. We are constantly fighting these kind of rumors that are usually the result of "personal" experiences. It is not unreasonable to ask for the process that is the bases of a particular personal experience so that we can review and either confirm or not there is a bug involved.

 

BTW, we don't need to see a profile of comment, he has proven his outstanding knowledge and abilities with over 22,000 helpful posts. He is one of, if not, the MOST KNOWLEDGABLE DEVELOPER I know, and I follow his advise to the letter.

 

Lee

Posted

hmmm...

so I was wondering the variable "Count" I could not re create this ...

If someone would like to help me that would be great Claus has been kind enough to help me with this solution, I don't want to pour oil on the storm here but I do need this solution, so if anyone extraneously commenting here can address the central question I put…

that would be most welcome….

Posted

To both "comment" and Lee;
I do not question whether "comment" is competent or not, nor do I contest his/her contribution to the community. However, I don't like to argue with an annonymus person.
I have not said that there is a bug, in which case I would have reported it to Filemaker Inc.
The reason I do not use the import script step, when solving these kinds of problems is that I don't find it reliably. That is because the import field mapping order could change in the script step, if you create, edit or delete fields in either of the 2 involved tables. In order to be sure that did not happen, or to update the field mapping, I would have to go into the scripts and check. No problem, if you only have 1 or 2 scripts, but in a large solution there could be many scripts you should check. That is why I don't use it. I did not say "Don't solve your problem that way", just said that I have choosen another solution.
And this is not a bug, it is just how Filemaker works.
Others can have another opinion, which is fine, I just tried to help the thread starter with a solution to his problem.
 
Which is why I created a simple example with comments, which I hope is easy to understand.
So, redballon, check the sample and if you have questions, you are welcome to ask. Hope the sample could help you.
 
Just, so this thread don't get anymore out of hand, I would point out that the example is just one way of solving the relations, there are other ways of accomplishing this, and one of them is by using the import records step instead of my loop.

Demo_Grouping.fmp12.zip

Posted
First of all, it seems like you are on a vendetta.. which seems very odd.

Second, it is very difficult to take this discussion or your last comment seriously, when your profile is annonymus.

 

I am not the topic here, so you can safely leave my motivation, background and any other personal attribute out of this discussion.

Posted
SetVariable ( $count ) is a counter, that keeps track of how many records you create.

As "comment" has written, you could also accomplish this with Import records.

...however, I stopped using that pracsis years ago, since I don't find it reliably enough.... but thats just my experience...

I can't see how to set that ...

Posted
have you downloaded the example and tried to run with debugger on ?

HI Claus,

Yes I have I have altered it a bit...

since I needed it to do a few other things...

It does not seem to creature the join records...

I put in a Show custom dialogue pop up so I can see it is finding 995 records in a search but then it fails to create join records...

I am looking into this...

Thanks...

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