AnsweredAssumed Answered

Extract / retrieve field / button name

Question asked by BenOtto on Jul 1, 2014
Latest reply on Jul 7, 2014 by BenOtto

Title

Extract / retrieve field / button name

Post

Point of departure:

     Let's assume I have a 2-level hierarchy database, e.g. a set of boxes and each box has 100 slots (1:n match). Table 1 stores the boxes, table 2 the slots associated with each table.

     Table 1 ("Boxes") has a field storing the UIDs of the slots stored in table 2 ("Slots").

     Table "Slots" has:

     1) a field ("occupation") flagging, whether my slot is occupied or not.

     2) a name "name" field for more simple names (A1-J10).

     3) a reference field "boxUID" to the UID of the associated box.

Goal:

     I would like to display my slots as a graphical solution that:

     1) shows which slots of a box are occupied and which not. If a slot is occupied the slot should be colored differently from the basic color (here in red vs light blue). So I want filemaker to check each slot associated with a box record and color the corresponding slot field according to its occupation state.

     2) allows me to click on one of the slots Filemaker and return the name (A1-J10) of this slot.

     3) is "inactivated" if it is occupied so I cannot perform step #2.

     Attached is an image of my current solution.

My current construct:

     Each of the displayed slots is a button.

     a) Each button exits in a duplicate layered above each other. The upper button/field is colored in red and is displayed or hidden according to a calculated condition. The condition is a query that get the name of the slot (here is my current problem!!!) and checks the occupation state of the slot. What happens under the hood is: Pass the name (e.g. "A1") to the query function, go the "Slot" layout, search for the record matching the "boxUID" and the "name", and finally check the occupation state within this record. If the slot is occupied, I'll display the upper red field which will mask the lower one. Once the slot is free this upper entity is hidden and I get access to the button below.

     b) Each of the lower buttons invokes a function that just stores the name of the slot into some field / somewhere. 

Problem:

     Now my current Problem is the following. My current solution requires that I pass the NAME (e.g. "A1") to the function/query in step a) for the hiding/displaying. Because the button has to know somehow which slot it represents. So I had to adjust each button for itself and hard-code the name of this button into the function. Similar with step b) I only can return the name of this button when I have hard-coded the name within the function.

     Which is ... a mess.

     First because it's really hard labour. Second because if I want to change something in the formulas I have to change the formula for each bloo***y single button. Third because "second" means: This is an accident waiting to happen. If I can't manage the equations/queries independent in one single master function, it is only a question of time until somewhere the code breaks or gets inconsistent.

Thoughts:

     What I was hoping for was that I could "extract" the field/button name itself via some function and pass it to my query/output functions. Then I would just link my buttons to some central script or function that is managed within the scripts of functions and can be edited for all at once. Then I could just create one first "Slot-button" entity and just copy/paste it 100 times and give each button a distinct name such as "A1" or "D3" and so on. As soon as I change something, I'll just change it in my scripts or function sections but I don't have to touch the single buttons.

Question:

     Unfortunately it seems there is no way read out the field name in Filemaker 13 Pro. Is that true?

     Is there some very simple and efficient way for my problem that I might have missed? Maybe I'm just doing it much too complicated.

      

     Thanks and cheers

      

     Ben

      

Bildschirmfoto_2014-07-01_um_17.04.48.png

Outcomes