Jump to content
Server Maintenance This Week. ×

SQL based Value Lists drawing upon multiple fields/tables?


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

Recommended Posts

I know how to create conditional value lists using sql based on a single field but I'm wondering if it's possible to draw upon alternative fields given a set of conditions set out in a Case function. I know how to do this when drawing upon values from a single field but I'm struggling with how to incorporate multiple fields, which live in different tables. 

 

Any ideas? 



In case that's convoluted, I'm using a single field in a portal and I want the value list to draw values from Field1, Table1 under one set of criteria set out in a Case function, while drawing upon Field2, Table2 under another set of criteria. Hope that's more clear. 

 

Thanks in advance!

Link to comment
Share on other sites

After you gather value list values via sql, what do you do with them?  Set them to a field that has a value list based on it?

 

If you are using sql already, then it should be a simple If statement:
If (

    yourCondition ;

    sql select from Table1::Field1 ;

    else sql select from Table2::Field2

)

Link to comment
Share on other sites

Yup, that's what I was doing. I think there might be something wrong with both my Case function and the way I have the relationship set up. The second condition doesn't seem to work on its own, while the first one breaks down when (my intended and probably faulty) second condition is set anywhere in the portal.

 

I'm trying to get this to work from a portal (Table1) where I first create a record by way of a button that sets a field to condition "A" or "B". Based on this condition, I want the value list to draw values from either Table2::Field2 or Table3::Field3. The calc field that generates the SQL based conditions lives on Table3 and is related to Table1 (the portal table). I'm not an expert with FMP or SQL so I can't really even remember the logic of this set up, just that it worked with a single SQL condition after some trial and error. 

 

I have some ideas about rearranging the Table structure to make this work (namely creating a super table that holds all the values) but I guess I just wanted to know if there was a possibility of this technique working. 

 

Happy thanksgiving, by the way. 

Link to comment
Share on other sites

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