1

I'm building a database in FileMaker 12 that will, among other things, keep a list of jobs (indicated by numeric ID) and the employees who had billable time for that job.

Given three tables:

Employee ( empName, empID, salary, ... )
JobHours ( empID, jobID, hrsWorked, ... , refID)
JobCost  ( jobID, expenses, profit, ... , refID)

Where:

Employee is my personnel roster matching names to numeric employee IDs and stats (salary, et al) ;

JobHours is a list of employee participation -- whenever an employee spends time on a job, this table has a line that shows their ID, the job ID, hours worked, and a few other things;

JobCost is a daily record of jobs. One entry in this table refers to the activity for a single job on a single day. Additionally, each entry gets a system generated unique ID (since neither jobID nor date is unique) to relate to JobHours (resulting in a list of who worked on a particular job on a particular day).

I have a form showing records from JobCost. For each record, I can see in a portal, showing records from JobHours, who worked on that job on that day.

Now, the issue.

In my portal, I want to have a drop-down list of employee names pulled from a value list to create records in JobHours with the following criteria:

1) I need it to be a drop-down rather than a pop-up so it will respond to auto-fill from the keyboard. A drop-down will show the secondary value (employee name) from a value list while dropped down, and will respond properly to keyboard autocomplete on the secondary value, but once you've made your selection, it only displays the primary value (employee ID).

2) I need it to display names, not IDs, at all times. The pop-up does this perfectly. However, it doesn't seem to respond to the keyboard for typing autocompletes.

3) I need to store the numeric ID rather than the name.

I know how to satisfy any two of these criteria at once, but that's all. The whole database is working beautifully otherwise. Is this behavior possible?

4

3 回答 3

2

一种常见的技术是使用两个字段,一个直接在另一个之上。

在底部,放置您的 JobHours::EmpID 字段。使用您指定的值列表将其设置为下拉列表。

在 JobHours::EmpID 字段的顶部放置相关的 Employee::EmpName 字段。设置字段,使其不能在浏览或查找模式下输入。

现在您的用户将看到员工姓名,但是当他们单击该单击时,将穿过顶部字段并进入员工 ID 字段,他们将从值列表中选择姓名。

于 2013-07-20T02:08:11.417 回答
0

我来到这个线程寻找解决同一问题的方法(允许用户从列表中选择,显示他们的选择,但存储相关值)。例如,从下拉列表中选择植物物种名称,在下拉字段中显示植物物种名称,但让它存储分类序列号(TSN;这很可能多年来保持不变)。这在 MS Access 中很容易做到,但在 FMP12 中需要更多的麻烦。

我是如何解决的:我在表中创建了两个字段来存储值:Plant_TSN 和 Plant_SciName。这两个字段中的值之间必须存在关系。就我而言,我将每个 TSN 的 SciName 存储在查找表中。然后,我在布局中创建了两个字段,每个新字段一个。

对于您希望存储的值(例如 Plant_TSN):将相应的布局字段设为下拉列表并包括显示/隐藏箭头。编辑您将填充下拉列表的值列表以显示第二列(便于阅读),但存储第一列值。在布局中缩小字段以仅显示箭头。

对于您希望用户看到的字段(例如 Plant_SciName):将另一个布局字段设置为编辑框,并防止在浏览或查找模式下输入字段。但它与上一步中创建的下拉箭头相对,以使看起来像一个字段。

最后,在第一个字段(仅箭头下拉菜单)中编写一个脚本,当在下拉菜单中选择用户丑陋的 (Plant_TSN) 值时,将用户友好的数字 (Plant_SciName) 推送到编辑框。我使用了下拉格式化字段的 OnObjectSave 脚本触发器。脚本应该类似于 1) 冻结窗口,2) 转到相关记录(基于查找表中的关系 3)设置字段(即编辑框)和 4) GotoLayout[original] 以抵消冻结。

可能不是一个完全清楚的解释,但我敢打赌,你会在第三次阅读时得到它!我会张贴截图,但我显然需要 10 个“声望点”。

干杯。

于 2014-07-22T20:39:01.560 回答
0

pft 的解决方案是我长期使用的解决方案,但我仍然觉得它不优雅,因为用户在更改值时仍然会在字段中看到现有的 id 编号。

如果提前输入很重要,我会使用弹出菜单。一旦通过 Tab 键或单击激活菜单,用户就可以从键盘输入,并且选择将根据输入的内容而改变。

于 2013-07-21T06:05:06.250 回答