简体   繁体   English

Spotfire:过滤表以从每个组中获取一条记录

[英]Spotfire: Filtering table to get one record from each group

I have the following table:我有下表:

UWI西印度群岛大学 FORM形式 SOURCE资源 MD医学博士
123 123 BRAIDED编织 DRR减灾减灾 100 100
123 123 BRAIDED编织 ERK ERK 150 150
123 123 BRAIDED编织 KPB KPB 200 200
123 123 TUSCHER图舍尔 DRR减灾减灾 300 300
123 123 TUSCHER图舍尔 MDB多边数据库 350 350
123 123 TUSCHER图舍尔 KPB KPB 375 375
456 456 BRAIDED编织 DRR减灾减灾 150 150
456 456 BRAIDED编织 KPB KPB 275 275
456 456 TUSCHER图舍尔 BTM BTM 500 500
456 456 TUSCHER图舍尔 DRR减灾减灾 550 550
456 456 TUSCHER图舍尔 ERK ERK 525 525

All columns are string columns except MD, which is Real, however no math is required.所有列都是字符串列,但 MD 除外,MD 是实数,但不需要数学。

I need to filter the data so that only one row for a particular UWI and formation are returned based on a set hierarchy of the SOURCE.我需要过滤数据,以便根据 SOURCE 的一组层次结构仅返回特定 UWI 和编队的一行。

The hierarchy is:层次结构是:

  1. ERK ERK
  2. MDB多边数据库
  3. DRR减灾减灾
  4. KPB KPB
  5. BTM BTM

What I'm looking for is a table that looks like this once the filter is applied:我正在寻找的是应用过滤器后看起来像这样的表格:

UWI西印度群岛大学 FORM形式 SOURCE资源 MD医学博士
123 123 BRAIDED编织 ERK ERK 150 150
123 123 TUSCHER图舍尔 MDB多边数据库 350 350
456 456 BRAIDED编织 DRR减灾减灾 150 150
456 456 TUSCHER图舍尔 ERK ERK 525 525

What is the best way to accomplish this?完成此任务的最佳方法是什么? I thought about adding a DenseRank calculated column, which will group the rows by UWI and FORM using SOURCE for the ranking, but there are two problems with that:我想过添加一个 DenseRank 计算列,它将使用 SOURCE 进行排名,按 UWI 和 FORM 对行进行分组,但这样做有两个问题:

  • I don't know how to assign a particular rank number to a particular source;我不知道如何将特定的排名编号分配给特定的来源; and
  • If I take the resulting ranking based on the alphabet, if I add a new source (let's say KMP just under ERK) it will mess up some of the other ranking numbers.如果我根据字母表获得结果排名,如果我添加一个新来源(假设 KMP 就在 ERK 之下),它会弄乱其他一些排名数字。

I've thought of using a Case statement, but I'm not sure how to group the UWI and FORM (I know about OVER, but every example I've found requires some kind of number column to do an aggregation).我想过使用 Case 语句,但我不确定如何对 UWI 和 FORM 进行分组(我知道 OVER,但我发现的每个示例都需要某种数字列来进行聚合)。

This filter will be applied just after import.此过滤器将在导入后立即应用。

Any direction would be greatly appreciated!任何方向将不胜感激!

I received an answer from the Tibco community on how to do this:我从 Tibco 社区收到了关于如何执行此操作的答复:

On top menu:在顶部菜单:

Data > Column Properties > select SOURCE数据 > 列属性 > select SOURCE

Choose Sort Order tab.选择排序选项卡。

Choose Custom Sort Order and configure the desired order选择自定义排序顺序并配置所需的顺序

press OK按确定

Now define the calculated column [SourceRank] as现在将计算列 [SourceRank] 定义为

DenseRank([SOURCE],Concatenate([FORM],[UWI]))

The filter can then be applied to [SourceRank]=1.然后可以将过滤器应用于 [SourceRank]=1。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 spotfire如何从一列中的两个值获取计算列 - spotfire how to get a calculated column from two values in one column 如何在Spotfire中使用带有层次结构过滤的复选框工作? - How to get checkbox with hierarchy filtering in Spotfire to work? Spotfire - 按计算列中的值过滤表 - Spotfire - Filtering a Table by Values in a Calculated Column spotfire uniquecount在一对多表中 - spotfire uniquecount in an one to multiple table 如何使用IronPython从Spotfire中的表的所有列中获取值 - How to get values from all the columns of the table in Spotfire using IronPython 在Spotfire表中对标签进行排名,分组和设置 - Rank, group and set a label in Spotfire table 将spotfire页面(或“仪表板”)从一个spotfire文件移动到另一个 - Move spotfire Page (or “dashboard”) from one spotfire file to another 使用 Python 脚本在 Spotfire 中仅重置一个特定的过滤方案 - Reset ONLY ONE specific filtering scheme in Spotfire by using a Python script Spotfire-从一个表中获取介于另一个表中两个日期之间的数据,并将其添加到计算列中 - Spotfire - Getting data from one table that falls between two dates in another table and adding to a calculated column 使用 Spotfire 中另一个表中的数据在一个表中创建计算列? - Create calculated column in one table using data from another table in Spotfire?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM