英文:
Does Pentaho allow the "Filter rows" step to load a list of values?
问题
我需要根据包含应与列label
中存在的值匹配的正确值的列表DOM_LABEL
来过滤表的行。
DOM_LABEL = ['Microsoft', 'Apple', 'Lenovo']
这个列表包含在一个csv文件中。
问题是,一些行包含不正确的值,比如'Samsung'
,'HP'
等。我不知道存在哪些不正确的值,因此通过过滤label
值不包含在DOM_LABEL
中的行可以帮助我更好地分析问题。
然而,筛选行
步骤不允许我加载值的列表。手动将它们添加到步骤中很麻烦,因为DOM_LABEL
包含超过100个值。有没有办法将这些值加载到筛选行
步骤中?
英文:
I need to filter the rows of a table according to a list DOM_LABEL
that contains the correct values that should match the ones present in the column label
.
DOM_LABEL = ['Microsoft', 'Apple', 'Lenovo']
this list is contained inside a csv file.
The problem is that some rows have incorrect values such as 'Samsung', 'HP', etc
. I don't know the incorrect values present, so by filtering the rows by label
values not contained in DOM_LABEL
helps me analyze the problem better.
However, the Filter rows
step does not allow me to load a list of values. And manually adding them into the step is gruesome because the DOM_LABEL
contains more than 100 values. Is there a way to load those values into the Filter rows
step?
答案1
得分: 1
我认为在这种情况下,如果我正确理解了问题,最佳解决方案是事先设置一个字段,该字段检查值是否在列表中,然后在该字段上筛选行。
如何做到这一点?
在单独的步骤中从 CSV 中加载数据(CSV 输入)。然后在主流程的“筛选行”步骤之前,使用“流式查找”步骤来查找主流程列中的值在 CSV 中的值。检索您查找值的列。然后在筛选行中,只需检查查找的值是否为空。
英文:
I think the best sollution in this case, if I'm understanding the issue correctly, is by setting up a field beforehand, which checks if the value is in the list and then filter rows on that field.
How to do this?
Load the data from the csv in a seperate step (csv input). Then in your mainflow BEFORE the filter row step, us a 'stream lookup' step to find the value from your main flow column in the csv. retrieve the column i which you lookup the value. Then in the filter rows, just check if the lookedup value is empty or not.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论