如何选择只显示不等数据结果和负或盲等数据结果? [英] How can I choose to show only unequal data result and minus or blind equal data result?

查看:31
本文介绍了如何选择只显示不等数据结果和负或盲等数据结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的机器人代码

两个表上都有 22 条记录,但只有 1 条记录具有不相等的数据我想显示该结果并减去或不显示相等的数据结果.

There are 22 records on both tables but only 1 record has an unequal data I would like to show that result and minus or blind an equal data result.

 connect to database using custom params  cx_Oracle    ${DB_CONNECT_STRING}
 @{queryResultsA}=   Query  Select count (*) from QA_USER.SealTest_Security_A order by SECURITY_ID
 Log  ${queryResultsA}
 @{queryResultsB}=   Query  Select count (*) from QA_USER.SealTest_Security_B order by SECURITY_ID
 Log  ${queryResultsB}

should not contain match    ${queryResultsB}  ${queryResultsA}

推荐答案

  1. 使用 For 循环

 # Assuming your table has values like this
@{queryResultsA}=   Create List     a   b   c   d   e
@{queryResultsB}=   Create List     a   z   c   d   e

${Length}=  Get Length      ${queryResultsA}
${count}=   Set Variable

:FOR     ${count}   IN RANGE     ${Length}      
\       Run Keyword If  '@{queryResultsA}[${count}]'!='@{queryResultsB}[${count}]'      Log To Console      @{queryResultsA}[${count}] @{queryResultsB}[${count}]

输出
b z

使用 SET

${z} =  Evaluate    (set(${queryResultsA}) - set(${queryResultsB}))
Log     ${z}

输出
b

注意这里的差异是从集合 A 中减去集合 B,所以集合 A 中不匹配的将是输出.

Note the difference here Set B is subtracted from Set A so whatever not matched in set A will be the output.

这篇关于如何选择只显示不等数据结果和负或盲等数据结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆