我有一个 Excel 365 日志条目表。日志按开始标记和结束标记分组。
Column C: =IF( LEFT([@LOGS],6)="<Event","start", IF(LEFT([@LOGS],7)="</Event","end", ""))
原始数据:
TAG_START_END LOGS
start <Event time="Sat Apr 15 1:13:17.750" type="Debug" thread="2fec: Main CIM worker thread" elapsed="0"
Database: C:\2023 Files\GDBs_4\New Mobile Geodatabase.geodatabase
SQL: SELECT main.ACTIVE_TRANSPORTATION.OBJECTID,main.active_transportation_nt_flag_vw.flag FRO
end </Event>
start <Event time="Sat Apr 15 1:13:17.749" type="Debug" thread="2fec: Main CIM worker thread" elapsed="1"
end </Event>
start <Event time="Sat Apr 15 1:13:17.749" type="Debug" thread="2fec: Main CIM worker thread" elapsed="2"
Database: C:\2023 Files\GDBs_4\New Mobile Geodatabase.geodatabase
SQL: SELECT main.ACTIVE_TRANSPORTATION.OBJECTID,main.active_transportation_nt_flag_vw.flag FRO
Number of features returned: 100
end </Event>
start <Event time="Sat Apr 15 1:13:17.749" type="Debug" thread="2fec: Main CIM worker thread" elapsed="0"
end </Event>
start <Event time="Sat Apr 15 1:13:17.747" type="Debug" thread="2fec: Main CIM worker thread" elapsed="0"
Database: C:\2023 Files\GDBs_4\New Mobile Geodatabase.geodatabase
SQL: SELECT main.ACTIVE_TRANSPORTATION.OBJECTID,main.active_transportation_nt_flag_vw.flag FRO
end </Event>
start <Event time="Sat Apr 15 1:13:17.747" type="Debug" thread="2fec: Main CIM worker thread" elapsed="2"
Database: C:\2023 Files\GDBs_4\New Mobile Geodatabase.geodatabase
SQL: SELECT main.ACTIVE_TRANSPORTATION.OBJECTID,main.active_transportation_nt_flag_vw.flag FRO
Number of features returned: 100
end </Event>
start <Event time="Sat Apr 15 1:13:17.746" type="Debug" thread="2fec: Main CIM worker thread" elapsed="1"
end </Event>
start <Event time="Sat Apr 15 1:13:17.746" type="Debug" thread="2fec: Main CIM worker thread" elapsed="0"
end </Event>
start <Event time="Sat Apr 15 1:13:17.744" type="Debug" thread="2fec: Main CIM worker thread" elapsed="0"
Database: C:\2023 Files\GDBs_4\New Mobile Geodatabase.geodatabase
SQL: SELECT main.ACTIVE_TRANSPORTATION.OBJECTID,main.active_transportation_nt_flag_vw.flag FRO
end </Event>
start <Event time="Sat Apr 15 1:13:17.743" type="Debug" thread="2fec: Main CIM worker thread" elapsed="1"
end </Event>
对于每个标签组,我想填充 GROUP_ID 列。
在上面的屏幕截图中,我在该字段中手动输入了值。现在,我想找到一种使用公式或 Power Query 填充字段的方法。
如何填充 GROUP_ID 列?
原因:我想最终找到一种将 LOGS 信息转换为列的方法: https: //i.stack.imgur.com/EfTUV.png。我认为 GROUP_ID 列会有所帮助。
有关的:
将 Diagnostic Monitor 日志复制为 Excel 表格,而不是垂直标记
编辑:
这是如何使用 SQL 完成的:
Oracle SQL -根据开始/结束标记将 GROUP_ID 分配给行
sum(case when log_tags like '<Event%' then 1 else 0 end) over (order by id)
可以在 Excel 中完成类似的操作吗?