I am working a bug and during project creation if the user selects a Large Sto

I am working a bug and during project creation if the user selects a Large Store, Convenience Retail or Drug Value originating channel the selection of project subtype should be an optional (not required) selection. The dropdown selection should not be removed.

Could anyone let me know what could be the logic which I should use so that" Project Subtype"should be optional for Large Store, Convenience Retail or Drug Value originating channel . We are using expression rule "prmOrigChanHasProjectSubType"

=if(contains({cons!PRM_ORIG_CHAN_REGION, cons!PRM_ORIG_CHAN_STORE_LG, cons!PRM_ORIG_CHAN_CONV_RETAIL, cons!PRM_ORIG_CHAN_DRUG_VALUE, cons!PRM_ORIG_CHAN_CANADA, cons!PRM_ORIG_CHAN_OTHER}, ri!origChannel), true(), false())

Also , we have used this expression rule to List of originating channel subtypes for Large Store.

={null(), cons!PRM_ORIG_CHAN_TYPE_REG_CPI, cons!PRM_ORIG_CHAN_TYPE_REG_NONCPI}

Please note the attached screenshot.....

OriginalPostID-119837

OriginalPostID-119837

  Discussion posts and replies are publicly visible

  • First, I'd note that the contains() portion of your first expression will suffice instead of the if(<condition>,true,false).

    Second, I'd print out the value of ri!origChannel (at the time you interact with the first dropdown) and test the contains() expression in an expression editor to make sure the logic is correct.
  • Thanks Evan...

    We are using this expression rule "prmListOrigChanSubTypeByOrigChan" to returns a list of channel sub types by originating channel.
    =if(ri!origChannel=cons!PRM_ORIG_CHAN_REGION, rule!prmListOrigChanSubTypeRegion(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_STORE_LG, rule!prmListOrigChanSubTypeStoreLG(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_CONV_RETAIL, rule!prmListOrigChanSubTypeConvRetail(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_DRUG_VALUE, rule!prmListOrigChanSubTypeDrugValue(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_CANADA, rule!prmListOrigChanSubTypeCanada(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_OTHER, rule!prmListOrigChanSubTypeOther(), ri!origChannelSubTypes))))))
    We have used this expression rule "prmListOrigChanSubTypeStoreLG()" to List of originating channel subtypes for Large Store as per the above expression rule has been defined.
    ={null(), cons!PRM_ORIG_CHAN_TYPE_REG_CPI, cons!PRM_ORIG_CHAN_TYPE_REG_NONCPI}
    Please note the screenshot and let me know what exactly I need to change and in which logic I need to use and make some changes so that "Project Subtype"should be optional for Large Store, Convenience Retail or Drug Value originating channel .


  • Need to know which expression I need to change and what logic I should use out here...
    prmOrigChanHasProjectSubType,prmListOrigChanSubTypeByOrigChan,prmListOrigChanSubTypeStoreLG()
  • Hi
    Any insight on the below issue which we have facing on our project will be helpful. I am working on a bug and during project creation if the user selects a Large Store, Convenience Retail or Drug Value originating channel the selection of project subtype should be an optional (not required) selection. The dropdown selection should not be removed.
    Could anyone let me know what could be the logic which I should use so that" Project Subtype"should be optional for Large Store, Convenience Retail or Drug Value originating channel .
    We are using an expression rule "prmOrigChanHasProjectSubType" to pick the originating channel from the constant used out in this expression. PRM_ORIG_CHAN_STORE_LG = Large Store
    =if(contains({cons!PRM_ORIG_CHAN_REGION, cons!PRM_ORIG_CHAN_STORE_LG, cons!PRM_ORIG_CHAN_CONV_RETAIL, cons!PRM_ORIG_CHAN_DRUG_VALUE, cons!PRM_ORIG_CHAN_CANADA, cons!PRM_ORIG_CHAN_OTHER}, ri!origChannel), true(), false()).
    Then we have used " prmGetProjectProjectSubType" to returns the updated value of Project SubType based on originating channel info.
    =if(rule!prmOrigChanHasProjectSubType(ri!origChannel), if(isNull(ri!origChannelSubType), "N/A", ri!origChannelSubType), "N/A")
    We have used this express "prmListOrigChanSubTypeByOrigChan" to returns a list of channel sub types by originating channel.
    =if(ri!origChannel=cons!PRM_ORIG_CHAN_REGION, rule!prmListOrigChanSubTypeRegion(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_STORE_LG, rule!prmListOrigChanSubTypeStoreLG(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_CONV_RETAIL, rule!prmListOrigChanSubTypeConvRetail(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_DRUG_VALUE, rule!prmListOrigChanSubTypeDrugValue(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_CANADA, rule!prmListOrigChanSubTypeCanada(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_OTHER, rule!prmListOrigChanSubTypeOther(), ri!origChannelSubTypes))))))
    Finally we have used this expression rule "prmListOrigChanSubTypeStoreLG" to list of originating channel subtypes for Large Store.
    Could anyone let me know what could be the logic and in which expression rule which I should use so that" Project Subtype"should be optional for Large Store, Convenience Retail or Drug Value originating channel .




  • Thanks Evan.. The logic you have provided is not that much clear for me. Could you please elaborate so that I can work on this issue. What could be the contains() portion of my first expression which will suffice instead of the if(<condition>,true,false).
    Second,how I will print out the value of ri!origChannel (at the time of interact with the first dropdown that is CPI or Non-CPI in the Project Subtype dropdown list) and test the contains() expression in an expression editor to make sure the logic is correct.?
    Expression rule "prmOrigChanHasProjectSubType"
    =if(contains({cons!PRM_ORIG_CHAN_REGION, cons!PRM_ORIG_CHAN_STORE_LG, cons!PRM_ORIG_CHAN_CONV_RETAIL, cons!PRM_ORIG_CHAN_DRUG_VALUE, cons!PRM_ORIG_CHAN_CANADA, cons!PRM_ORIG_CHAN_OTHER}, ri!origChannel), true(), false()).
    Expression rule "prmListOrigChanSubTypeByOrigChan"
    =if(ri!origChannel=cons!PRM_ORIG_CHAN_REGION, rule!prmListOrigChanSubTypeRegion(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_STORE_LG, rule!prmListOrigChanSubTypeStoreLG(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_CONV_RETAIL, rule!prmListOrigChanSubTypeConvRetail(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_DRUG_VALUE, rule!prmListOrigChanSubTypeDrugValue(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_CANADA, rule!prmListOrigChanSubTypeCanada(),
    if(ri!origChannel=cons!PRM_ORIG_CHAN_OTHER, rule!prmListOrigChanSubTypeOther(), ri!origChannelSubTypes))))))
    Expression rule "prmListOrigChanSubTypeStoreLG"
    ={null(), cons!PRM_ORIG_CHAN_TYPE_REG_CPI, cons!PRM_ORIG_CHAN_TYPE_REG_NONCPI}

  • I have tried as per suggested by you and updated this rule. It did not work for me Project Subtype value still showing required instead of optional when we select a Large Store, Convenience Retail or Drug Value from originating channel list.
    Expression rule "prmOrigChanHasProjectSubType"
    =(contains({cons!PRM_ORIG_CHAN_REGION,cons!PRM_ORIG_CHAN_STORE_LG, cons!PRM_ORIG_CHAN_CONV_RETAIL, cons!PRM_ORIG_CHAN_DRUG_VALUE, cons!PRM_ORIG_CHAN_CANADA, cons!PRM_ORIG_CHAN_OTHER}, ri!origChannel))

  • What I am suggesting you do is first test out that ri!origChannel actually gets the value you select from the first dropdown. So make a test field on your form with value:ri!origChannel. Then, take this ri!origChannel and, in the expression editor, plug it into your prmOrigChanHasProjectSubType rule.

    My comments on the other rules were:
    1) prmOrigChanHasProjectSubType: the contains() function returns a boolean already so you don't need the if(). What you're doing with the if() is a superfluous if(true,true,false).

    2) prmListOrigChanSubTypeStoreLG: instead of all of these subsequent if() calls, check out the choose() function
  • I have tried the choose function in the expression rule "prmListOrigChanSubTypeByOrigChan" but it is geting an error "expression evaluation error at function 'choose'; Choose index cannot be null"

    choose (ri!origChannel, cons!PRM_ORIG_CHAN_REGION, rule!prmListOrigChanSubTypeRegion(),
    cons!PRM_ORIG_CHAN_STORE_LG, rule!prmListOrigChanSubTypeStoreLG(),
    cons!PRM_ORIG_CHAN_CONV_RETAIL, rule!prmListOrigChanSubTypeConvRetail(),
    cons!PRM_ORIG_CHAN_DRUG_VALUE, rule!prmListOrigChanSubTypeDrugValue(),
    cons!PRM_ORIG_CHAN_CANADA, rule!prmListOrigChanSubTypeCanada(),
    origChannel=cons!PRM_ORIG_CHAN_OTHER, rule!prmListOrigChanSubTypeOther(), ri!origChannelSubTypes)
  • Thanks Evan...I have tried the below syntax and getting the below error in the expression... "There is missing parenthesis"
    choose(
    wherecontains(ri!origChannel, {cons!PRM_ORIG_CHAN_REGION})[1],(ri!origChannel, {cons!PRM_ORIG_CHAN_STORE_LG})[2],
    (ri!origChannel,{cons!PRM_ORIG_CHAN_CONV_RETAIL})[3],(ri!origChannel,{cons!PRM_ORIG_CHAN_DRUG_VALUE})[4],
    (ri!origChannel,{cons!PRM_ORIG_CHAN_CANADA})[5],(ri!origChannel, {cons!PRM_ORIG_CHAN_OTHER})[6], ri!origChannelSubTypes)