运行SQL查询,以数组形式返回响应对象。我需要知道如何创建循环以读取返回的每个记录

我正在运行一个SQL查询,并以空手道的数组形式返回对象。一世 知道如何读取返回的第一条记录/行。我需要知道如何 创建一个循环以一次读取所有记录。

这是调用SQL查询的开始,我正在分配对象 变量。

Scenario Outline: Premium-IC or IR Invoice Type  
* def op_ic_ir_query = karate.readAsString('classpath:Payments/
CSC_Payments_API/Queries/qry_Get_Overpayment_IC_IR.txt')
* def OP1 = Stardb.readRows(op_ic_ir_query)
* def OP_cpid = OP1[0].CONTRact_PAYMENT_ID
* def OP_cid = OP1[0].CONTRact_ID
* def OP_iid = OP1[0].INVOICE_ID
* def OP_Idate = OP1[0].INVOICE_DATE
* def OP_dtp = OP1[0].DATE_TO_PROCESS
* def transactionAmt = OP1[0].TRANSactION_AMOUNT
* def invoiceAmt = OP1[0].INVOICE_AMOUNT
* def taxAmt = OP1[0].TAX_AMOUNT
* def paidAmt = OP1[0].PAID_AMOUNT

下一步是计算多付款项。

# Calculate overpayment_amount - need to keep rolling total for 
overpayment amount.
* def overpaymentAmt1 = (transactionAmt - ((invoiceAmt + taxAmt) - 
paidAmt))
ly0110 回答:运行SQL查询,以数组形式返回响应对象。我需要知道如何创建循环以读取返回的每个记录

以下是在空手道中循环的方法:

1)Scenario Outline and Examples

2)Using call and a second feature file

3)Using JS

根据您要执行的操作,如果简化了事情,也许您应该在Java代码本身中进行循环。

我的建议是(2),因为您需要动态数组。因此,如果void setup() { Serial.begin(9600); } void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A0); // Convert the analog reading (which goes from 0 - 1023) // to a voltage (0 - 5V): float voltage = sensorValue * (5.0 / 1024.0); // print out the value you read: Serial.println(voltage); Serial.println(analogRead(A0)); delay(500); } 是JSON-s数组:

foo
本文链接:https://www.f2er.com/3169721.html

大家都在问