Jump to content

need help with a script


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

Recommended Posts

Hi guys, 

 

I am new to filemaker, I have managed to create a database following some tutorials but now I have encountered a problem I am unable to solve. I think the problem is mainly in the script. Because I really need this done fast I will transfer the first person that can solve it 30 euros. 

I am doing a research on flamingos in zoos. I have used two portals in the layout: one zoo can have multiple enclosures and each enclosure can hold multiple species of flamingos (see attachments). In the layout view this is working great, but I need it to work in the tableview so I can export the data. The problem in the tableview is that the EnclosureID used in the flamingo table and in the enclosure table are not the same (in the screenshot the first enclosureID is in the flamingo table, but is not related to any enclosure or zoo data). In the tableview screenshot you can see a record of one zoo, for which all the data is filled in in the layout but only for one flamingo in the table. For every zoo there is only one real enclosureID generated for the enclosure that is selected on that moment. For some reason it saves only the first enclosure you fill in, when you select the second enclosure it shows the right data in the layout view but in the table view it shows the data of the first enclosure, besides that the enclosureID and all the related data disappears for the first enclosure that is then no longer selected.

I am using the following script for the select button:

 

Set Field [Zoo:SelectedEnclosure; Enclosure::EnclosureID]

Commit Records/Requests [No Dialog]

 

I would be really, really grateful if someone can fix it, I am getting a bit desperate haha. Please let me know if you need any additional information. 

 

Greetings,

Tobias

Layoutview.PNG

Relations.PNG

Tableview.PNG

Link to comment
Share on other sites

Let me start with this:

20 minutes ago, Vliet057 said:

I need it to work in the tableview so I can export the data.

Exporting works on the data layer. It has nothing to do with how your layout is set up and in what view it is. If your problem is with exporting, then you need to reformulate your question and explain what exactly are you trying to export.

 

28 minutes ago, Vliet057 said:

Because I really need this done fast I will transfer the first person that can solve it 30 euros. 

I don't think this is appropriate.

  • Like 1
Link to comment
Share on other sites

As comment mentioned: let us know what data you want to export.  The layout shows data from 3 tables so exporting could be complex, or it could be simple.  If you export from the context of the animal in the enclosure then it could be simple because from there you can pick up info from the enclosure and the zoo.

So bottom line; pretty sure you do not want to export from the context of that layout.

Link to comment
Share on other sites

I will try to explain it a bit better. What you see in the tableview is the flamingo table, with some fields from enclosure and zoo added. I want to export the table to excel exactly as it shows in the table view. The problem is not exporting but how the data is saved from the layout. As you can see in the screenshot of the table view there is only enclosure and zoo data for one flamingo, while in the layout there is data on 5 enclosures and 6 flamingo species for that zoo. But from the layout only the data from the enclosure that you select is put in the table. 

I've attached another screenshot from the tableview from the same zoo. In this case all the data in the layout is the same, I have only selected the third enclosure now in the layout. The tableview now only shows the data for the third enclosure (two flamingo species), but this is actually the data for the first enclosure with the flamingos of the third enclosure. 

What I want is for the table to show the right data for all the flamingos at the same time. 

Enclosure3.PNG

Tableview2.PNG

Edited by Vliet057
Link to comment
Share on other sites

You are not telling us which table occurrence your layout is based on. And I don't see what role the "questionnaires" you show us play in this. Or the additional relationship showing only flamingos in a selected enclosure.

If you want to export data describing flamingos and their enclosures and zoos, your layout must be set to show records from the "Flamingos 2" table occurrence. Then the related fields - such Zoo:City - will be populated for all flamingo records that are properly related to their parent enclosure.

Link to comment
Share on other sites

Sorry. The layout is based on the Zoo table occurrence, the table is based on the Flamingo table. I think the problem is that the flamingos are not properly related to their enclosures, because every flamingo has an enclosureID (in the flamingo table at least), but this is not the same as the enclosureID in the enclosure table, so also not related to this data.

Like I said I just started with filemaker so I am having a hard time to explain exactly what the problem is, the tables should just be filled with the data that is filled in in the layout, but it is not.  

Link to comment
Share on other sites

13 minutes ago, Vliet057 said:

The layout is based on the Zoo table occurrence, the table is based on the Flamingo table.

I am talking about the layout that shows the table. Switch it to Form view and click the [ Edit Layout ] button. Then select "Flamingo 2' from the "Layout:" drop-down menu. Then press [ Exit Layout ], switch back to Table view and see what happens.

 

Edited by comment
Link to comment
Share on other sites

Maybe this helps. If you would only look at the layout you would say that the table looks like this, and this is what I want to achieve. 

Tableview2.PNG

5 minutes ago, comment said:

 

6 minutes ago, comment said:

I am talking about the layout that shows the table. Switch it to Form view and click the [ Edit Layout ] button. Then select "Flamingo 2' from the "Layout:" drop-down menu. Then press [ Exit Layout ], switch back to table view and see what happens.

Wooow it works! Thank you thank you thank you! 

Do you want the reward even though you find it inappropriate?

Edited by Vliet057
Link to comment
Share on other sites

11 minutes ago, comment said:

Then select "Flamingo 2' from the "Layout:" drop-down menu.

I forgot to add that you also need to check all the "local" fields (the fields from the Flamingo table) and make sure they belong to the current table occurrence.

 

12 minutes ago, Vliet057 said:

Do you want the reward even though you find it inappropriate?

Save it for some other occassion...

Link to comment
Share on other sites

2 minutes ago, comment said:

I forgot to add that you also need to check all the "local" fields (the fields from the Flamingo table) and make sure they belong to the current table occurrence.

They are not... But the data seems to be right in the table now. What can happen if they are from the other table? 

Link to comment
Share on other sites

5 minutes ago, Vliet057 said:

What can happen if they are from the other table? 

Nothing good. They need to be from the same TO as the layout. Otherwise they will show data from the related record (if the two TO's are somehow related) or show "<Unrelated Table>". 

 

Edited by comment
Link to comment
Share on other sites

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