简体   繁体   English

戈苏(导线)

[英]Gosu (Guidewire)

If we need to consider two states of claim (eg - Draft & Closed state) for temporary claim, then how can we use these state using Query?如果我们需要为临时索赔考虑两种索赔状态(例如 - Draft 和 Closed 状态),那么我们如何使用 Query 来使用这些 state? I tried with -我试过 -

var claims = Query.startswith("ClaimNumber", "TMP", false)
.compareIn(Claim#State, {ClaimState.TC_DRAFT, ClaimState.TC_CLOSED}.toArray())
.select()

The above line throws null pointer error.上述行抛出 null 指针错误。 Could anyone help on this?有人可以帮忙吗?

I believe the Claim Entity has enough data to be queried.我相信索赔实体有足够的数据可以查询。

Also i see the "make" statement is missing in the code given by you.我还看到您给出的代码中缺少“make”语句。 Try the below query in your Gosu Scratchpad,在您的 Gosu Scratchpad 中尝试以下查询,

uses gw.api.database.Query
var claims = Query.make(Claim)
  .startsWith("ClaimNumber","TMP",false)
  .compareIn(Claim#State, {ClaimState.TC_DRAFT, ClaimState.TC_CLOSED} as ClaimState[])
  .select()

for(claim in claims){
 print(claim.ClaimNumber)
}

If you still face any issues, please provide the exception that you get.如果您仍然遇到任何问题,请提供您得到的例外情况。

Please mark the answer as correct if my info solved your issue.如果我的信息解决了您的问题,请将答案标记为正确。

Try with or block ,尝试使用or阻止

uses gw.api.database.Query
 var queryCliamState= Query.make(entity.Claim)
          .compare("ClaimNumber", Equals, "12345")
         .or(\orCondition -> {
              orCondition.compare("State" , Equals,typekey.ClaimState.TC_DRAFT)
              orCondition.compare("State" , Equals,typekey.ClaimState.TC_CLOSED)
 }) .select()

-When you are comparing make sure the state is equal to the database field. - 当您进行比较时,请确保 state 等于数据库字段。

Looks like you are missing the make sentence:看起来你错过了make句子:

var claims = Query.make(Claim).startsWith("ClaimNumber", "TMP", false)
    .compareIn(Claim#State, {ClaimState.TC_DRAFT, ClaimState.TC_CLOSED}.toArray())
    .select()

It should work after that.它应该在那之后工作。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM