AronGahagan / cpt-dev

Code repository for the ClearPlan Toolbar
https://www.ClearPlanConsulting.com
3 stars 1 forks source link

cptDynamicFilter - handle when no custom fields are set up yet #338

Closed AronGahagan closed 1 year ago

AronGahagan commented 1 year ago

Problem:

If the user has not yet set up any custom fields, the string is empty, and an error is triggered.

Text/cptDynamicFilter_bas.bas:56:      strCustomFields = Left(strCustomFields, Len(strCustomFields) - 1)

Solution:

      'remove terminal comma, reducing array size by one
      If Len(strCustomFields) > 0 Then
        strCustomFields = Left(strCustomFields, Len(strCustomFields) - 1)
        vArray = Split(strCustomFields, ",")
        Call cptQuickSort(vArray, 0, UBound(vArray))
        'join vArray into string, prepend 'Task Name', split into array
        .List = Split("Task Name," & Join(vArray, ","), ",")
      Else
        .List = Array("Task Name")
      End If

Todo: