gpt4 book ai didi

Querying Notion database with formula field returns incorrect formula results(使用公式字段查询概念数据库返回错误的公式结果)

转载 作者:bug小助手 更新时间:2023-10-24 19:43:11 28 4
gpt4 key购买 nike



I am using Google Apps Script to query data from a Notion database and create calendar events in my Google Calendar.

我正在使用Google Apps脚本从概念数据库中查询数据,并在我的Google日历中创建日历事件。


I have come across some odd behavior that I can't figure out.

我遇到了一些奇怪的行为,我搞不懂。


My Notion database has one entry for each event. Each event has a start and end date (stored in a single date field). I have some formulas that use the start and end dates to calculate different fields (ex: how many years have elapsed since July 1, 2020). When I look at the Notion page I see one value, and when I query the database via the API I get a different value, but only for some entries.

我的概念数据库为每个事件都有一个条目。每个事件都有开始和结束日期(存储在单个日期字段中)。我有一些公式,它们使用开始日期和结束日期来计算不同的字段(例如,自2020年7月1日以来已经过去了多少年)。当我查看概念页面时,我看到一个值,当我通过API查询数据库时,我得到一个不同的值,但只针对某些条目。


In the two images below note the entry called "Peds Neuro"
See the Notion database here
See the Debug output here

在下面的两张图片中,请注意名为“PEDS Neuro”的条目请参见此处的概念数据库此处查看调试输出


Any help would be appreciated!

如有任何帮助,我们将不胜感激!


更多回答

I am experiencing the same for an automation that relies on the data. I assume that the recent updates to the formula-feature has introduced a regression.

对于依赖数据的自动化来说,我也经历了同样的情况。我假设最近对公式功能的更新引入了一种回归。

Can you please provide the formula for Period?

您能提供一下期限的公式吗?

There can be differences if the formula is based on dates without time. When you access the details from API, they are usually based on UTC. But on UI, they can be timezone specific. So if you are accessing at a time where for UTC date is ahead or behind your timezone date, it can cause such issues.

如果公式基于不带时间的日期,则可能会有所不同。当您从API获取详细信息时,它们通常基于UTC。但在用户界面上,它们可以特定于时区。因此,如果您访问的时间UTC日期早于或晚于您的时区日期,则可能会导致此类问题。

very interesting! Here is the formula for period: min(max(floor((dateBetween(dateStart(prop("Date")), dateAdd(fromTimestamp(1593576000000), prop("PGY") - 1, "years"), "days") + if(day(dateAdd(fromTimestamp(1593576000000), prop("PGY") - 1, "years")) % 7 < 4, day(dateAdd(fromTimestamp(1593576000000), prop("PGY") - 1, "years")) % 7 - 1, day(dateAdd(fromTimestamp(1593576000000), prop("PGY") - 1, "years")) % 7 - 8)) / 28), 0), 12) + 1 Is there a way to make the formula timezone agnostic?

非常有趣!以下是周期的公式:min(max(floor((dateBetween(dateStart(prop(“Date”)),日期添加(起始时间戳(1593576000000),属性(“PGY”)-1,“年份”),“天”)+IF(日期添加(起始时间戳(1593576000000),属性(“PGY”)-1,“年份”))%7<4,天(日期添加(起始时间戳(1593576000000),属性(“PGY”)-1,“年份”))%7-1,日(日期添加(起始时间戳(1593576000000)),PROP(“PGY”)-1,“Year”))%7-8))/28),0),12)+1有没有办法使公式时区不可知?

From your formula I can not see if Date or PGY are rollups from relations. I still thought I let you know that I have just received following response from the support at Notion: > We have identified a bug related to API not returning values of formula when relations have been used in it. I believe your API calls are also affected by this.

从您的公式中,我看不出DATE或PGY是从关系中汇总出来的。我还是想让你知道,我刚刚从Concept的支持那里得到了以下回应:>我们发现了一个与API相关的错误,当在其中使用了关系时,没有返回公式的值。我相信您的API调用也受此影响。

优秀答案推荐
更多回答

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com