Skip to Content
avatar image
Former Member

sort multiple parameters by one field & the rest other field not working!

I want to sort based on a parameter "Status"; so if the status is Funded, Funded-as Asked, or Funded - New Designation, then I want sort by date funded field. Otherwise, I want to sort Date asked field.

Here is formula and I receive this error message: This array must be subscripted. For example, Array<i>.

if ({?Status}) in ["Funded","Funded - As Asked","Funded - New Designation" ] then

{CnPrProp_1.CnPrProp_1_Date_Funded}

else

{CnPrProp_1.CnPrProp_1_Date_Asked}

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Oct 15, 2008 at 09:21 PM

    FYI - I have tried this trick with multiple if's instead of an Array and it worked. But I would like to know if it is possible to have single array, rather than multiple if's.

    Formula

    ==============================================

    if ({?Status}) = "Funded" then

    {CnPrProp_1.CnPrProp_1_Date_Funded}

    else if ({?Status}) = "Funded - As Asked" then

    {CnPrProp_1.CnPrProp_1_Date_Funded}

    else if ({?Status}) = "Funded - New Designation" then

    {CnPrProp_1.CnPrProp_1_Date_Funded}

    else

    {CnPrProp_1.CnPrProp_1_Date_Asked}

    ==============================================

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Since the parameter is multivalued parameter you have to specify the index number like this

      if {?Parameter}[1]="Funded" then {CnPrProp_1.CnPrProp_1_Date_Funded}

      else

      {CnPrProp_1.CnPrProp_1_Date_Asked}

      or you need to use forloop to check each value exist in that list.

      So I think it is better to use if else statement.

      Regards,

      Raghavendra

  • avatar image
    Former Member
    Oct 15, 2008 at 11:02 PM

    I think this works fine

    if "Funded" in {?Status}[1 to count({?Status})] or 
    "Funded - As Asked" in {?Status}[1 to count({?Status})] or 
    "Funded - New Designation" in {?Status}[1 to count({?Status})] then 
    {CnPrProp_1.CnPrProp_1_Date_Funded}
    else
     {CnPrProp_1.CnPrProp_1_Date_Asked}

    Regards,

    Raghavendra

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2008 at 09:43 PM

    Thaks all. Raghavendra, your solution works like a charm. This is what I was looking for. My solution also worked but if there is the need to have more fields to be sorted, then it is inefficient solution.

    Edited by: Abdillahi Youssouf on Oct 23, 2008 12:49 PM

    Add comment
    10|10000 characters needed characters exceeded