问题描述
嗨大家好,我是b $ b $
我目前正在组织中使用Projects Web Database模板,我想重新排列"File As"中的语法。我的客户数据表的字段,因此优先级转到公司的字段而不是姓氏/名字。
理想情况下,当公司名称为空时,表达式仍然会给出姓氏。 请参阅下面的当前表达式。
Hi folks,
I'm currently utilizing the Projects Web Database template in my organization and I would like to rearrange the syntax in the "File As" field of my Customers datasheet so the priority goes to the field for Company instead of Last Name/First Name. Ideally, the expression would still give a Last Name when Company Name is empty. See below for the current expression.
IIf(IsNull([LastName]),IIf(IsNull([FirstName]),[Company],[FirstName]),IIf(IsNull([FirstName]),[LastName],[LastName] & ", " & [FirstName]))
最终目标是一个引用"File As"的表单。如果两个字段中都有内容,则获取公司而不是姓名的字段,这应该足够简单,但我还没有能够解决上述语法问题。
感谢您的时间。
The end goal is for a form which references the "File As" field to fetch Company rather than Last Name if there is something in both fields, which should be simple enough but I haven't been able to wrap my head around the above syntax as yet.
Thanks for your time.
推荐答案
尝试将其分解为单独的部分然后一次一个地添加每个部分。例如,由于您希望公司名称优先,您可以先检查公司名称。
Try breaking it down into separate pieces and then add each piece together one at a time. For example, since you want the Company name to take precedence, you can check for it first.
IIf(非IsNull([Company]),[Company],"No Company" )
IIf(Not IsNull([Company]), [Company],"No Company")
如果存在,上述将使用[公司];否则,它将使用"No Company"。如果您对其进行测试,并且它按预期工作,那么您可以添加LastName而不是"No Company"。例如:
The above will use [Company] if it exists; otherwise, it will use "No Company." If you test it, and it is working as intended, then you can add the LastName instead of "No Company." For example:
IIf(非IsNull([Company]),[Company],IIf(Not IsNull([LastName]),[LastName],"No Company and no Last Name" ;))
IIf(Not IsNull([Company]), [Company], IIf(Not IsNull([LastName]), [LastName], "No Company and no Last Name"))
依旧......
希望它有所帮助......
Hope it helps...
这篇关于如何正确排列“文件为”的语法表达?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!