操作方法

操作方法:在 Survey123 Connect for ArcGIS 中排除日期问题中的日期

Last Published: May 5, 2022

摘要

在 Survey123 Connect for ArcGIS 中创建包含日期问题的调查时,可以排除公共假期和周末等日期,因为这些日期可能与调查无关。 用户可能希望在调查中仅包含工作日。

过程

要在 Survey123 Connect for ArcGIS 中排除日期问题中的公共假期或周末,请应用约束。 但是,在应用约束之前,必须以十进制时间使用 format-date() 函数将日期转换为可读格式。 这是因为 Survey123 for ArcGIS 默认将日期和时间值处理为新纪元时间 (也称为 Unix 时间)。 新纪元时间将时间存储为自 1970 年 1 月 1 日起经过的毫秒数,这是一个近似值。 此时间每毫秒还在不断变化,四舍五入到最接近的值。


要将日期问题的新纪元时间更改为十进制时间,请创建引用日期问题的辅助问题。 使用 format-date(${date},'%m/%d/%Y') 表达式将日期转换为日期格式。 在约束列中使用 format-date() 函数将约束应用于辅助问题。


按照以下说明获得所需结果:

  1. 登录到 Survey123 Connect for ArcGIS 并创建一个新调查,或者使用 Dates & Time 模板打开现有 .xls 调查表。
  2. 在调查表中,在 name 列中创建时间问题。 在本示例中,日期问题名为 date

    Survey form with name and type columns
     
  3. name 列中针对公共假期和周末创建辅助问题。 在本示例中,公共假期名为 holiday_constraint,周末名为 wkend_constraint

    Survey form with constraints added
     
  4. 对于辅助问题,在 calculation 列中,针对公共假期和周末输入计算表达式。
    在本示例中,format-date(${date},'%m/%d/%Y') 表达式用于公共假期,format-date(${date},'%a') 表达式用于周末。
    :
    系统提供各种 format-date 表达式用于日期问题。 例如:
    
    format-date(${date_question},'%m/%d/%Y') = 25/12/2019
    format-date(${date_question},'%m') = 12
    format-date(${date_question},'%b %d, %Y') = Dec 25, 2019
    
    选择所需表达式。

    Format-date expression added in calculation column
     
  5. 对于约束,在 constraint 列中,针对公共假期和周末使用 format-date() 函数。 在本示例中,选择 Christmas Day 作为公共假期。 用于公共假期的 format-date() 函数为 .!='12/25/2019',用于周末的为.!='Sat' and .!Sun'。

    Format-date function added for public holiday and weekend in constraint column
     
对于 calculation 列(上图)和 constraint 列(下图),下图显示了 .xls 工作表中的完整调查表。

Survey table with completed calculation column

Survey table with completed constraint column
 

文章 ID:000019690

从 ArcGIS 专家处获得帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项

相关信息

发现关于本主题的更多内容