MS InfoPath 问题

发布于 2024-10-16 19:28:44 字数 1017 浏览 0 评论 0原文

编辑4:

我终于能够解决我自己的问题了。请参阅下面的复选标记答案。

编辑3: 我觉得我已经非常接近解决这个问题了,只剩下一个障碍了。过滤器只能应用在列表框、组合框或下拉列表框中。我能够过滤我的信息,但我需要获得已过滤信息的最大值,但我不知道如何执行此操作。我已经尝试了 max 函数,但得到的只是 NaN。

请参阅屏幕截图

您会注意到我的“当前年份 #s +1 默认为 NaN。但是当我从过滤的下拉列表中选择一个数字时,它会起作用。我需要能够默认为列表中的最大数字。 请参阅另一个屏幕截图。我似乎不知道如何默认最大报告数量。有什么建议或想法吗?

编辑2: 问题仍然没有答案。将把最近的编辑移到顶部。

编辑1: 看来我们正在采用 Ktharsis 方法。他建议在我们获得 MAX(@ID) +1 之前的一年使用过滤器。我还不确定如何实现这一点。在获得 MAX(@ID) +1 之前,是否有一个公式可以在 Sharepoint 中过滤年份,以便我们的连续 ID 每年都会重置?一旦得到答复,我将发布另一个更新。

我正在尝试创建一个唯一的计数器 ID,该 ID 将在新的一年重置。我已经记下了数字计数器,但我不知道如何在新的一年开始时重置它。

例如:2010-0057、2010-0058、2010-0059.....2011-0001、2011-0002 等。

相反,它只是继续序列。关于如何实现这一点有什么想法吗?首选方法是不使用编程。附带说明一下,我正在将其与 SharePoint 网站集成,并且实际上是从 SharePoint 的 ID 字段获取序列号。我正在为我的数列使用 MAX(ID) 公式。

** 第一次使用这个网站,所以如果这个问题不属于这里,我很抱歉。

Edit 4:

I was finally able to solve my own issue. See checkmark answer below.

Edit 3:
I feel like I'm really close to solving this, just one hurdle remains in my way. Filters can only be applied in list boxes, combo boxes, or drop down list boxes. I am able to get my information filtered, but I need to get a MAX value for the information I've filtered and I have no idea how to do this. I've tried the max function and all I'm getting is NaN.

See screenshot.

You'll notice my "Current Year #s +1 defaults to NaN. But when I select a number from the filtered drop down, it works. I need to be able to default to the max number in my list.
See another screenshot. I can't seem to figure out how to default to the max report number. Any suggestions or ideas?

Edit 2:
Question still remains unanswered. Going to move most recent edits to the top.

Edit 1:
It seems like we are going with Ktharsis approach. He suggested using a filter for the year before we get the MAX(@ID) +1. I'm not sure how to implement this yet. Is there a formula to filter for the year in Sharepoint before getting the MAX(@ID) +1 so that our sequential IDs will reset for each year? I will post another update once this is answered.

I am trying to create a unique number counter ID that will reset on the new year. I have the number counter part down, but I have no idea how to make it reset when a new year begins.

Example: 2010-0057, 2010-0058, 2010-0059..... 2011-0001, 2011-0002 etc.

Instead it's just continuing the sequence. Any ideas on how to implement this? The preferred method is without the use of programming. On a side note, I am integrating this with a SharePoint site and I am actually getting my sequential number from SharePoint's ID field. I am using a MAX(ID) formula for my number sequence.

** First time using this site so I am sorry if this question doesn't belong here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

审判长 2024-10-23 19:28:44

在 InfoPath 中,您可以通过这种方式在公式中获取当前年份(无需编程)。

substring(today(), 1, 4)

但是,如果您的系统设置不是美国英语,则格式可能会有所不同(如果您的用户有不同的系统设置,则不是一个好主意)。

要从 SharePoint 中获取正确的数据,您需要过滤列表。您当前正在请求所有列表数据并获取 MAX(ID)。过滤此列表以仅获取当前年份,然后获取 MAX(ID),它将为您提供正确的序列号。

In InfoPath you can get the current year in a formula (no programming needed) this way.

substring(today(), 1, 4)

However the format might differ if your system settings are not US English (not a good idea if your users have different system settings).

To get the correct data out of SharePoint you will need to filter your list. You are currently asking for all the list data and getting MAX(ID). Filter this list to only get the current year and then get MAX(ID) and it will give you the correct sequence number.

榆西 2024-10-23 19:28:44

我终于想通了!尽管 Ktharsis 确实给了我一些建议,但他并没有回答我的问题,即我实际上有什么东西有效。因此(不是刺),我正在回答我自己的问题并向你们展示我做了什么。

我如何在每个新年重置自动生成的数字:
忽略我之前所有关于使用下拉框过滤器的编辑。这些都不起作用。这就是你所需要的。在您的提交规则中,添加一条规则以从您的共享点位置查询数据(不完全确定此步骤是否必要,但不会有什么坏处)。将下面的另一条规则添加到“设置字段值”。在“字段”选项下选择“数字计数器字段”。

在“值”选项下,输入:

max(@Report_Number[@Year = substring-before(today(), "-")]) + 1

这将获取当前年份的最大报告编号并加 1 。因此,如果报告编号 20 是您的 Sharepoint 数据库中的最高报告编号,那么现在您提交的报告编号将为 21。这将从每年开始。

对于我的表单,我的“数字计数器字段”基本上为我的“报告数字字段”提供信息,并在必要时添加零。例如,如果我的报告编号为 2,它将发布报告编号 0002。

我还没有尝试看看如果新的一年没有任何报告会发生什么。但是您可以在此之前添加一条规则来查找最大报告编号,如果它为零,则将此报告编号设置为 1。

如果您对我的解决方案有任何疑问。请告诉我。在发布这个问题之前,我已经花了几个月的时间来解决这个问题。感谢所有提供帮助的人。

I've finally figured it out! Although Ktharsis did give me several tips, he did not answer my question to where I actually had something that worked. Therefore (not to be a prick), I am answering my own question and showing you guys what I did.

How I reset the autogenerating number at every new year:
Ignore all my previous edits about using drop box filters. None of that works. This what you need. On your submit rules, add a rule to query data from your sharepoint location (not entirely sure if this step is necessary, but it doesn't hurt). Add another rule below to "Set a fields value". Select your "Number Counter Field" under the "Field" option.

Under the "Value" option, enter this:

max(@Report_Number[@Year = substring-before(today(), "-")]) + 1

This will get the max report number for the CURRENT year and add 1 to it. So if report number 20 is your highest report number in your sharepoint database, it will now make this report you are submitting number 21. This will start over each year.

For my form, my "Number Counter Field" basically feeds my "Report Number Field" and adds zeros when necessary. For example if I'm on report number 2, it will post Report Number 0002.

I haven't tried seeing what happens if there aren't any reports for the new year. But you can add a rule right before this to find the max report number and if it is zero, make this report number 1.

If you have any questions on my solution. Please let me know. I've spent months on this problem before I posted the question. Thanks to everyone that helped.

长伴 2024-10-23 19:28:44

也许我在这里遗漏了一些东西,但是如果您从共享点获取序列号,那么该数字是否总是会增加,除非您创建一个新的列表或库来从中提取它?如果这样做,那么数字应该从 0 开始。

Maybe I am missing something here, but if you are getting your sequential number from sharepoint, won't that number always increase unless you create a new list or library to pull it from? If you do that then the number should start over at 0.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文