0

我想迭代 TempTable 的 ResultSet。例如:

MyTmpTable:
set emails = 'abc@xyz.com','qwe@xyz.com','asd@xyz.com';

for each mail in $(emails)
  //Api call with Id    https://myapiurl/$(mail)

next

这工作正常。我们使用硬编码的电子邮件进行了测试

MyTmpTable:
Load emails from Employee;

for each mail in $(emails)
   //Api call with Id    https://myapiurl/$(mail)

next

但是我们想用动态电子邮件进行迭代。所以尝试了上面的代码,但它抛出QVD UNEXPECTED END OF DATA 错误

再次尝试使用以下代码

MyTmpTable:
Load emails from Employee;

for each mail in FieldValueList('emails')
   //Api call with Id    https://myapiurl/$(mail)

next

这个时间循环工作正常,但 在 API 调用上出现相同的错误QVD UNEXPECTED END OF DATA 错误

这个实现有什么问题?

4

1 回答 1

0

首先尝试在变量中构建列表,然后它的行为就像硬编码列表一样。chr(39) 只是插入 ' 而不在初始声明中创建文本转义的技巧

EMAIL_LIST:
load 
    concat(emails,chr(39)&','&chr(39)) as Email_List
Resident employees
;

let zEmailList = chr(39)&fieldvalue('Email_List',1)&chr(39)
;

drop table EMAIL_LIST
;

for each mail in $(zEmailList)

trace $(mail);

//Api call with Id    https://myapiurl/$(mail)

next mail
于 2019-08-16T09:10:02.283 回答