计算字段和增量 [英] Calculated Fields and increments

查看:91
本文介绍了计算字段和增量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用起点构建系统,并且需要有关计算字段的帮助.

I am building a system using Starting Point and need help with calculated fields.

基本上,在创建估算时,它采用与链接到的项目相同的ID,并以"-1" 1为增量值.因此,如果增量-1存在,则对该项目的下一个估计将是-2,依此类推.

Basically when an estimate is created it takes the same ID as the project its linked to with a "-1" 1 being incremental value. So if the increment -1 exists the next estimate for that project would be -2 and so on.

例如

项目ID: 120000

首次估算: 120000-1

First Estimate: 120000-1

第二估算: 120000-2

Second Estimate: 120000-2

我已经找到了如何像这样id_project & "-" & 1那样在项目ID(存储为估算ID)之后添加连字符和数字,但是我不知道使用Filemaker如何使用计算所得的字段来查看和查看120000-2是东西,如果是120000-3

I have found out how to add a hyphen and number after the project ID (the stored as estimate ID) like so id_project & "-" & 1 but I have no idea using filemaker how to use calculated fields to look and see if 120000-2 is a thing and if it is make it 120000-3

任何帮助表示赞赏

推荐答案

我假设您至少在项目"和估算"之间有关系.可能是这样的事情(没有Estimates_self表的出现,我将在稍后介绍):

I'm assuming you have at least a relationship between Projects and Estimates. Perhaps something like this (without the Estimates_self table occurrence, which I'll get to in a moment):

如果您处于项目"上下文中(在与项目"表链接的布局上),则可以使用Count ( Estimates::id )之类的方法从那里获得计数.

If you're in the Projects context (on a layout linked to the Projects table), you can get a count from there using something like Count ( Estimates::id ).

如果要通过Estimates的上下文来实现此目的,请使用项目外键作为match字段,如上所示创建一个自联接.然后,您可以使用Count ( Estimates_self::id ).

If you want to make this happen from the context of Estimates, create a self-join as shown above, using the project foreign key as the match field. Then you can use Count ( Estimates_self::id ).

最后,没有任何关系图更改的选项是使用ExecuteSQL:

Finally, an option without any relationship graph changes would be to use ExecuteSQL:

ExecuteSQL (
  "SELECT COUNT(*) FROM Estimates WHERE project_id = ?" ;
  "" ; "" ;
  Estimates::project_id
)

所有这些都将为您提供给定项目的估计数量.在其中加上一个,您便有了后缀号以进行新的估算.

All of these will give you the number of estimates that a given project has. Add one to that and you have your suffix number for the new estimate.

这篇关于计算字段和增量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆