Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specifying relationship to ignore 1

Status
Not open for further replies.

thanh1800

Technical User
Aug 2, 2006
43
0
0
AU
I have two database with fields and I have two relationship linking them.

--dumby database--

-table 1-
name
fav_color
fav_day_of_week
address

-table2-
name
fav_color
fav_day_of_week
family_size

--end--

the relationship is
table1::fav_color=table2::fav_color
table1::fav_day_of_week=table2::fav_day_of_week

now sometimes i want to group people with the same fav_day_of_week

and sometimes i want to group people with the same fav_color

and sometime i want to group people with the same fav_day_of_week and fav_color

then i want to display these group
so that all records in these group is displayed on one form/layout/page

note table1 and table2 hold different details of the people
ie one is contact details and the other is personal details.

any surgestions are welcome
 
also how do you increment a global variable($$counter) by 1
eg

---code--
$$counter = $$counter+1
--end code--
 
nope actually i figured it out
Set Variable [$$counter; Value:$$counter + 1]

but can you increment the global variable by 1 without using a script?
 
I can't see why you have 2 databases for the data.
Or do you mean 2 tables. It's not very clear, you mix the two items.

I suppose you use one database and two tables.
Put the data in one table and use tabs to divide the different items.

With some self-join relationships you can bring the info together in a layout within the same table.

Use the filterkey technique, so you can make choices and combinations.

Set field is only available in ScriptMaker.
 
Thanks JeanW

yes I ment to say tables.

I now need to be able to retieve values in records to use in calculations

eg.

name fav_color fav_animal Value Global
kate red dog 1 12
jan blue dog 1 12
john red cat 10 12

so in this sample I want to retrieve values from the field Value and add them together

--code--

for(index = 0; index < last; index++){
$$global = $$global + Value[index]
}

--end code--

if someone can tell me how to retrieve values from specific records in a table it i be much appreciated

 
Nope I've just figured it out thanks
GetNthRecord ( Value; Index)

but can you do it with global variables?
 
The $ symbol references a local variable and two $$ symbols reference a global variable. An optional repetition number appears in square brackets [ ] immediately after the variable name.
 
ahh yes

now how to set a field row to a certain value?(reverse operation of the previous question)

eg.

--code--

set(Value;Index) = 20

--end code--
 
I don-t know what a field row is.
It doesn-t exist in FileMaker.
 
I mean
I want to specify the record to recieve the value

so eg.
field name = Value
record = 3

which currently holds the value of 10

now i want to specify the value to 20 so the dummy table will look like...

name fav_color fav_animal Value Global
kate red dog 1 12
jan blue dog 1 12
john red cat 20 12
 
--code--

set(field name;record ) = 20

--end code--
 
Use the relationship based upon the recordnr to set the field to the value.

Set Field [<table::field>; <value or formula>]

This can go only within a script.
 
Deciding what fields are common to all databases projects is a personal preference related to the way you design databases.
There are fields that always seem to be added at some point in the life of a database.
One if them is recordnr. or serialnr.

This field, as auto-enter serial number, is the most common method for creating relationships between files/tables.
It also provide an effective way to uniquely identify each record in the database.
 
so how would I use a recordnr to set the field("Value") in a specified record(#3) to the value 20?

and also is it posible to change the bacground color of a button, rectangle, layout etc... with script or something without having to set it manually in design mode?
 
Depend on how you wan to do it.

A simple set field script that act within the same table is no problem.
The moment you want to reach a field in another table/file, you need a way to reach that field.
One way to reach the record and the field can be a relationship, not necessarely, depend on what you want to do.
You can simply reach the record/field in the first part of the scriptstep.

Your syntax will always be : Set Field [<table::field>; <value or formula>]

The specified field doesn't have to be on the current layout.

If the result of the calculation doesn't match the target field type, and the validate option for the field is set to Always, the field will not be set and an error code is returned (which can be captured with the Get(LastError) function)

When possible, the Set Field script step makes the record active and leaves it active until the record is exited or committed. Scripts that use a series of Set Field script steps should group these steps together if possible, so that subsequent Set Field script steps can act on the record without having to lock the record, download and upload data, index the field, and so on, after each individual Set Field script step. These functions and record level validation are performed after the record has been exited or committed.

For the color question. A possible way to go:
Make a set of global container fields (in your developerstable f.i.) and a global repeat container field to hold the different colors
If you put the global container behind a transparent field (whatever this is) you can change the color simply by drag and drop the desired color from the repeating field to the color container.
This can be done in a 'preference' layout.
 
Another option for the background is a calculation field, result container.
The calculation holds the conditions for the colors.

For the textcolor you could use one of the new functions in FM.
 
yes i need my set field[] script to act on a table that is no the current active table.
well this is what I am doing
Set Field [<dummytable::Value>; <20>]

it works but the '20' only apears in the current active record.

I need to be able to specify the record(3) the 20 is to apear in.
 
and thanks you container idea might just work well for me

but feel free to throw some more idea into th mix
 
That's where you have to target your record first.
One way to do that is with a relationship with what you will be able to reach the record.

And for the ideas, I make a living developing applications, so, it's not because I'm a chef in a restaurant that I have to give food away for free at everyone who's hungry.

I want to help (if I can), not only you, also all the members on the forum. But not in dept and always with every single detail.

I want to show you the way, the direction to follow, the place where you can find the (a) solution.
And not knowing the structure or the design of your application, I, and everyone else, can only do that, nothing more.

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top