Skip to main content
Known Participant
Oct 12, 2023 8:02 AM UTC
Question

Index Error- Cannot index type Number (Integer) into type

Im getting Cannot index type Number (Integer) into type (DOCUMENT_DETAILS) - which is a cdt. 

local!indexNum is  just a local

                a!radioButtonField(
                  label: "Radio Buttons",
                  labelPosition: "ABOVE",
                  choiceLabels:rule!SKJ_GetForm(
                    {}

                  )['recordType!{228c141f-e2f8-4a93-bf0d-0dfed8c9c6b4}SKJ Form.fields.{af4b3fdd-a9a3-4ea7-82d9-8f16e323e35f}descEn'],
                  choiceValues:rule!SKJ_GetForm(
                    {}

                  )['recordType!{228c141f-e2f8-4a93-bf0d-0dfed8c9c6b4}SKJ Form.fields.{d69bf265-893b-4707-965c-3512e6e1c9bd}itemCode'],
   
            
                  value:
                  ri!DocDetails[local!indexNum].docForm,
       
                 
           
                  saveInto: {


                    ri!DocDetails[local!indexNum].docForm


                  },
                  required: true,
                  choiceLayout: "COMPACT",
                  validations: {}
                )

    5 replies

    Known Participant
    Oct 12, 2023 9:02 AM UTC

    Known Participant
    Oct 12, 2023 9:03 AM UTC

    and ri!DocDetails type is the CDT , and its an array 

    pls help

    Participating Frequently
    Oct 12, 2023 9:28 AM UTC

    Hi, 

    Is ri!DocDetails is an array? if it is not an array system will through an error when you try to index. Please make it as an array. 

    Known Participant
    Oct 12, 2023 9:29 AM UTC

    Yes it is

    harshitb6843
    Brainy
    Oct 12, 2023 10:10 AM UTC
    1. Try to force the variables in their correct types.
    2. Make sure every variable that you're indexing has data. 
    3. Use the index() function instead of [] to avoid these types of errors in future