Jump to content

conditional value list


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

Recommended Posts

Hi everyone :)

I am a verry big noob when it comes to filemaker pro 8 advanced and I need some help.

The problem is: I have a table called hardware and a table called software. In my software table there is a field called: computers.

I want the computer field to be a value list with a condition. My hardware table has records for not only computers but also for peripheral devices.

So my question is how would I make a value list that does the following:

if (Hardware::Category; "Server") or if(Hardware::Category; "Laptop") or if(Hardware::Category; "Desktop") then

show the value list of Hardware::Name in my software::Computers field.

How would I do this? Do I have to create a calculation field of the software::Computers field which links to the value list?

Could someone give me an example on how this would be done? Help is really appreciated ;)

right now the value list shows all the records of Hardware::Name including the peripheral devices >.<!

It should however only show the records which have the category field filled in with Server, Laptop or Desktop

I'm stuck on this problem xD (Which sounds quite stupid since it looks so easy to fix :S)

Link to comment
Share on other sites

You could make a field in Hardware called "isComputer":

Let( hw = Hardware::Category ; hw = "Server" or hw = "Laptop" or hw = "Desktop" )

Make a calculated field in Software called "One" that simply equals 1.

Make a relationship software::One = hardware::isComputer.

Now use the "include only related" option in your value list.

Link to comment
Share on other sites

Let( hw = Hardware::Category ; hw = "Server" or hw = "Laptop" or hw = "Desktop" )

I didn't really understand this part. Is hw the field isComputer and does that need to be a calculated field or..? :S

I tryed doing this in the isComputer field:

Let(Hardware::Category; IsComputer = "Server" or IsComputer = "Laptop" or IsComputer = "Desktop")

That doesn't compile. I need to use it like this:

Let ( {[} var1 = expression1 {; var2 = expression2...]} ; calculation )

How would I do this? :S I'm such a big noob! >.<

EDIT: nevermind this worked:

Let ( IsComputer = Hardware::Category; IsComputer = "Server" or IsComputer = "Laptop" or IsComputer = "Desktop")

xD

also: Which table do I need to use in the value list? And which related table do I need to fill in?

I did everything you've said, I created a field IsComputer (which I still don't know if it is hw or not)

made a calculation on the field like you suggested,

created a field called One in software, created a relationship between them,

created a value list with use only related values and now it only shows 0 or 1.

I really can't seem to figure this out >.>

Link to comment
Share on other sites

In that calculation, "hw" was not a field, but a variable I assigned inside the Let statement. The name is not significant.

It's just a simpler (to me) way to write:

Hardware::Category = "Server" or

Hardware::Category= "Laptop" or

Hardware::Category= "Desktop"

If any of those three statements are true, then the calculation result will be 1.

We want to use that result to make a relationship to the software table.

I would most likely make it a calculated field, but you could also use a number field with this calculation as an auto-entry option.

I named this field isComputer but you can call it whatever you like.

It looks like you tried to name the field isComputer and then use the field as part of its own definition, which is not allowed.

Sounds like you got pretty close. See if the attached file helps.

relatedvalues.zip

Link to comment
Share on other sites

In that calculation, "hw" was not a field, but a variable I assigned inside the Let statement. The name is not significant.

It's just a simpler (to me) way to write:

Hardware::Category = "Server" or

Hardware::Category= "Laptop" or

Hardware::Category= "Desktop"

If any of those three statements are true, then the calculation result will be 1.

We want to use that result to make a relationship to the software table.

I would most likely make it a calculated field, but you could also use a number field with this calculation as an auto-entry option.

I named this field isComputer but you can call it whatever you like.

It looks like you tried to name the field isComputer and then use the field as part of its own definition, which is not allowed.

Sounds like you got pretty close. See if the attached file helps.

Actually I wanted it to show the name of the hardware with a calculation of the category that it is in.

But this is a good start to set it up.

I have done exactly the same thing as in your example but it does not work for some reason :S

I'm setting category to a value through scripts so it might have to do something with that.

Allthough I'm quite sure that the value is set it still does not show in the software layout >.>!

Could you try to help me out?

The file is in dutch so it might be a bit hard to read I'll tell you what you need:

Table:

Hardware::Naam (the name of the hardware)

Hardware::Category (the hardware category)

Hardware::IsComputer

Software::One

Software::apparaat (is used for the field to show the name of the computers)

the value list looks exactly the same as yours but does not show anything

Value List:

Computers

Hardware::Category (Include only related)

(I want the value list to show the name of the hardware instead of the category that it is in. But I used this to check if it works, and it doesn't :()

Field label:

Gekoppeld aan

Field:

Software::Apparaat

layout:

Applicaties Bewerken

Could you take a look for me? It's really strange that it does not work :S

The IsComputer field is correct and works, The Category field is correct and works.

Only the value list doesn't display :S

I hope that you can find the source of the problem.

Thanks a LOT for your help Flitch. I really appreciate it ;)

(please don't judge my database xD It's the first I've ever made)

Here's the file:

inventarisator.zip

Link to comment
Share on other sites

You have several issues:

1. You had set the storage options of the Category field to unindexed, and disabled automatic indexing. Value lists require the field used to be indexed.

2. Your value list was set to show related Category values starting from Hardware, but it needs to start from the context you want to use during data entry -- in this case, from Software.

3. I thought it was the Name you wanted to show, not the Category -- in which case, select the Name field in the value list options.

4. You defined a relationship hardware::software that was not just based on One=IsComputer, but also included the Software ID. I assume you're using that relationship for another purpose (and probably don't need the "1" criteria). But we want to see all computers, not just the ones related to this particular software record. So make another Table Occurrence based on Hardware, and this time use only the One=IsComputer criteria. Base your value list on that.

  • Like 1
Link to comment
Share on other sites

You have several issues:

1. You had set the storage options of the Category field to unindexed, and disabled automatic indexing. Value lists require the field used to be indexed.

2. Your value list was set to show related Category values starting from Hardware, but it needs to start from the context you want to use during data entry -- in this case, from Software.

3. I thought it was the Name you wanted to show, not the Category -- in which case, select the Name field in the value list options.

4. You defined a relationship hardware::software that was not just based on One=IsComputer, but also included the Software ID. I assume you're using that relationship for another purpose (and probably don't need the "1" criteria). But we want to see all computers, not just the ones related to this particular software record. So make another Table Occurrence based on Hardware, and this time use only the One=IsComputer criteria. Base your value list on that.

Thanks a lot for your help Fitch. I've got it to work! :D

I really appreciate what you did for me :)

Thanks once again!

b.t.w. it seems that I can not increase your reputation on this board.

I would've because you helped me out. I don't see where I can do this :P? Or is that impossible?

I want to give something in return >.>

Link to comment
Share on other sites

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