Jump to content
Server Maintenance This Week. ×

Hiding popup if no value in conditional value list


Alex Quinlan

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

Recommended Posts

  • 4 months later...

Thanks eos.

 

The value list in question isn't empty - but it uses related values from another table. Sometimes there are no related values; in this case I would like to be able to hide the field.

Any thoughts?

 

Many Thanks

Sorry it took 5 months to reply :)

 

 

 

Link to comment
Share on other sites

The value list in question isn't empty - but it uses related values from another table. Sometimes there are no related values; in this case I would like to be able to hide the field.

Any thoughts?

​Indeed: the same solution holds (which it seems you haven't tried …?). 

It's not the value list that returns "<no values defined>", but the interface device you display that value list with; which you can verify by evaluating

ValueListItems ( Get ( FileName ) ; "YourValueListName" ) 

in the Data Viewer.

  • Like 1
Link to comment
Share on other sites

I did try but I cannot seem to get it to work.

 

I made the wrong assumption in how it worked after testing it on a blank database. I will play around with it more and see if I can figure out why its not working for me.

 

I'm afraid i'm not sure what you mean by 

It's not the value list that returns "<no values defined>", but the interface device you display that value list with

Link to comment
Share on other sites

According to the data viewer there are 24 results in the value list I am using.

I'm not sure if Im not understanding the problem or I haven't explained what I am trying to do thoroughly enough.

 

I will use an example to explain just incase.

 

I have a portal where I can add Companies and Contacts to a join table with a related Project. 

It is set up with a drop down for the Type of company. The next drop down will only show me those companies that do that kind of work. I then have another drop down with a list of contacts who only work for the company I select from the previous drop down.

What i'm hoping to achieve is hiding the drop down if the value list returns no values when the choice of Company reveals no related Contacts.

 

Thanks

The linespacing is a bit strange when posting since I was last working on this project and asking for help from this forum. :)

 

Link to comment
Share on other sites

Hi Alex,

sorry, I had very little time over the last two days; let me just note that this may be / probably is a context problem; but it would be helpful to see your relationships t(or have a file) to check if your Hide predicate is correct. 

On the other hand: why first add a join table entry, specify the type there, then see if there are contacts … when there is the chance there aren't?

A better way would IMO be to display a list of companies filtered by type and contact existence, so you already have a sensible short-list, and you can add any company, knowing that is does have contacts.

… and yes, the linespacing is odd!

Edited by eos
Link to comment
Share on other sites

Since you're using FMv13, you can use the every handy 'hide object when' feature.  You've just got to get the conditional calculation correct.  The calc that EOS supplied should work.  Since it's related data, you can also use the count function, something like this -    Count ( ValueListRelationship::ID )  Where the ID field is a serial number or something that you know without a doubt every record in the table will contain some kind of value.  Since FM is expecting a boolean value and evaluates anything > 0 as true, this will work.

Link to comment
Share on other sites

Since you're using FMv13, you can use the every handy 'hide object when' feature.

​Isn't using that feature the premise of this thread?

Count ( ValueListRelationship::ID )

​If you're not interested in the count itself, then IsEmpty ( ValueListRelationship::ID ) is probably* less expensive, since you only need to check on the existence of a single record to make this predicate true or false, regardless of the actual related count.

*Untested

Link to comment
Share on other sites

Thanks for the help.

I can certainly send you the file if your happy to have a look. I'm nervous about your thoughts on my beginner database :)

On the other hand: why first add a join table entry, specify the type there, then see if there are contacts … when there is the chance there aren't?

You will see in that the database hold records of Companies separate from the Contacts.

I did this to allow for a company to be in the database without having any contacts and a company to be attached to a project and not the personnel. It does however seem to be causing me some headaches.

 

I've removed most of the data but the core is still there. Apologies for the mess. :)

Username: Admin

No password!

aquinlan database.fmp12

 

Note/Edit - The layout which where im trying to hide the fields is under Details/Projects/Project Contacts.

Edited by Alex Quinlan
Link to comment
Share on other sites

While the conditional value list is calculated and displayed correctly, it seems you cannot get at the result in the portal context. You could either create a conditional VL that's evaluated from the portal context, or just use the same path with the expression 

IsEmpty ( Company_Contacts::id ) 

A tip: if you want to calculate a full name, simply try

Substitute ( 
  List ( First ; Last ) ; ¶ ; " " 
)

and don't forget to set the result data type to “Text”!

I did this to allow for a company to be in the database without having any contacts and a company to be attached to a project and not the personnel. It does however seem to be causing me some headaches.

See the attached file for an approach that should keep your drug consumption low.

 

FilterbyTypeAndOnlyAllowContacts_eos.fmp12.zip

  • Like 1
Link to comment
Share on other sites

Thanks Eos,

Im surprised the company_contact::id works. Its great!!!

 

I like your solution especially how much nicer it is to use. However, I still need to be able to add a company which hasn't had a contact associated with it.
But I can butcher my way through it and make it work to my needs. :)

 

Thanks for neater fullname calc.

You mention in an earlier post calculation being "expensive". Is the idea to get to the result you want with the least number of script actions?

 

I was in Canada over the winter period and this project has been on hold. My brain is slowly engaging back into Filermaker gear. I've enjoyed the learning experience though I'm glad I'm not dreaming about conditional value lists anymore. :) Thanks again for all the help.

 

 

Link to comment
Share on other sites

However, I still need to be able to add a company which hasn't had a contact associated with it.
But I can butcher my way through it and make it work to my needs. :)

No need for butcher​y; just edit the script to remove the If[] block that checks on existing contacts, so you can add a company w/o contacts; then (again) use that If[] condition as Hide condition.

Link to comment
Share on other sites

Im trying to add another field in the Add popup window for sub type.

 

I've tried to implement what I would like in the database you uploaded but am struggling to get the value list to work... again.

 

filterbytypeandSUBtype_aq.fmp12

 

 

edit- actually it appears to be working. I'll finish the contact/subtype side of it. 

 

Edited by Alex Quinlan
Link to comment
Share on other sites

Well i've mostly got it working how I would like on your database. Apart from the Get(foundcount) field - I dont really understand whats going on there. How is it counting the number of people who work for a company from the contacts table?

 

Edit - fixed something

 

filterbytypeandSUBtype_aq.fmp12

Edited by Alex Quinlan
Link to comment
Share on other sites

Apart from the Get(foundcount) field - I dont really understand whats going on there. How is it counting the number of people who work for a company from the contacts table?​

When evaluated via the relationship, it returns the count of the related set. You could also use a summary field “Total of” <aFieldGuaranteedToBeNonEmpty> in Contacts for that purpose.

The advantage is that you define a single field in the target table and can use it in any number of related tables, rather than defining a calc field
Count ( targetTO::nonEmptyField )
in each of these other tables.

Edited by eos
  • Like 1
Link to comment
Share on other sites

​Isn't using that feature the premise of this thread?

​If you're not interested in the count itself, then IsEmpty ( ValueListRelationship::ID ) is probably* less expensive, since you only need to check on the existence of a single record to make this predicate true or false, regardless of the actual related count.

*Untested

The hide feature wasn't specifically mentioned before, no.  There are a few different ways to hide/mask a layout element/field, I'm more in favor of the new hide feature that I mentioned.  

 

Your suggested method will work just as well, most certainly.  Looking at this deeper, your suggestion will take less resources and/or be easier to humanly understand.  Just goes to show there is always more than one way to skin to proverbial cat.

Link to comment
Share on other sites

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