Is it possible to query the database table with the rule inputs that are coming from nowhere?

Certified Associate Developer

Hello,

I'm exploring the code of already built application and came to know that there is a query rule which is getting called by Parent Interface with no parameters being passed but inside the query rule there are several rule inputs on the basis of which the values are getting fetched from database table. Also I checked the application and its working fine, I'm just curious to know how can this be possible?

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Associate Developer
    in reply to Mike Schmitt
    It is an expression rule that does a query. Below is the code from parent interface which calls the expression local!knowledgeBase: rule!SCM_getVWKnowledgeBase(pagingInfo: null).data,

    Below is the code in expression rule

    a!queryEntity(
    entity: cons!SCM_DSE_VW_KNOWLEDGE_BASE,
    query: a!query(
    logicalExpression: if(
    or(
    not(isnull(ri!id)),
    not(isnull(ri!topic)),
    not(isnull(ri!description)),
    not(isnull(ri!visibilityGroup)),
    not(isnull(ri!categoryTypeId)),
    not(isnull(ri!subCategoryTypeId)),
    not(isnull(ri!serviceOfferingTypeId)),
    not(isnull(ri!createdBy)),
    not(isnull(ri!createdOn)),
    not(isnull(ri!updatedBy)),
    not(isnull(ri!updatedOn))
    ),
    a!queryLogicalExpression(
    operator: "AND",
    filters: {
    if(
    not(isnull(ri!id)),
    a!queryFilter(
    field: "id",
    operator: "=",
    value: ri!id
    ),
    {}
    ),
    if(
    not(isnull(ri!topic)),
    a!queryFilter(
    field: "topic",
    operator: "includes",
    value: ri!topic
    ),
    {}
    ),
    if(
    not(isnull(ri!description)),
    a!queryFilter(
    field: "description",
    operator: "includes",
    value: ri!description
    ),
    {}
    ),
    if(
    not(isnull(ri!visibilityGroup)),
    a!queryFilter(
    field: "visibilityGroup",
    operator: "=",
    value: ri!visibilityGroup
    ),
    {}
    ),
    if(
    not(isnull(ri!categoryTypeId)),
    a!queryFilter(
    field: "categoryType",
    operator: "includes",
    value: ri!categoryTypeId
    ),
    {}
    ),
    if(
    not(isnull(ri!subCategoryTypeId)),
    a!queryFilter(
    field: "subCategoryType",
    operator: "includes",
    value: ri!subCategoryTypeId
    ),
    {}
    ),
    if(
    not(isnull(ri!serviceOfferingTypeId)),
    a!queryFilter(
    field: "serviceOfferingType",
    operator: "includes",
    value: ri!serviceOfferingTypeId
    ),
    {}
    ),
    if(
    not(isnull(ri!createdBy)),
    a!queryFilter(
    field: "createdBy",
    operator: "=",
    value: ri!createdBy
    ),
    {}
    ),
    if(
    not(isnull(ri!createdOn)),
    a!queryFilter(
    field: "createdOn",
    operator: "=",
    value: ri!createdOn
    ),
    {}
    ),
    if(
    not(isnull(ri!updatedBy)),
    a!queryFilter(
    field: "updatedBy",
    operator: "=",
    value: ri!updatedBy
    ),
    {}
    ),
    if(
    not(isnull(ri!updatedOn)),
    a!queryFilter(
    field: "updatedOn",
    operator: "=",
    value: ri!createdOn
    ),
    {}
    )
    }
    ),
    null
    ),
    pagingInfo: if(
    not(isnull(ri!pagingInfo)),
    ri!pagingInfo,
    a!pagingInfo(1, -1)
    )
    )
    )