機械翻訳について

findRowsMatchingCriteriaを使用した子Rowset内の行の検索

ビュー基準を使用して、newView()を使用して作成したビュー・オブジェクトをフィルタするだけでなく、ビュー基準を使用して関連コレクション内の行のサブセットを取得することもできます。

たとえば、TroubleTicketカスタム・オブジェクトに関連アクティビティの子オブジェクト・コレクションが含まれている場合、次に示すコードを使用して、関連コレクションで選択したアクティビティを処理できます:

def vo = newView('TroubleTicket_c')
vo.appendViewCriteria("Priority_c = 1 and Status_c = 'Open'")
vo.executeQuery()
def vc = null
// Process all open P1 trouble tickets
while (vo.hasNext()) {
  def curTicket = vo.next()
  def activities = curTicket.ActivityCollection_c
  if (vc == null) {
    addBindVariable(activities,'TodaysDate','date')
    vc = newViewCriteria(activities,"ActivityType_c in ('OC','IC') and CreationDate > :TodaysDate")
  }
  // Process the activities created today for inbound/outbound calls
  setBindVariable(activities,'TodaysDate',today())
  def iter = activities.findRowsMatchingCriteria(vc,-1)
  while (iter.hasNext()) {
    def activity = iter.next()
    // process the activity here
  }
}

newViewCriteria()関数は、nullバインド変数値を含むフィルタ式の述語を無視する必要があるかどうかを示すために使用できる、ブール型の3番目のオプションのパラメータignoreNullBindVarValuesを受け入れます。 省略した場合、このパラメータのデフォルト値はfalseです。