The CreatorCon Call for Content is officially open! Get started here.

How to use splice function in two dimensional array?

Ankita Kolhe
Tera Contributor

Hi Community,

 

I want to remove last two columns of an array. But splice method is not working. Seems like issue with the for loop.

 

var   grp = (gr.groupings.getDisplayValue()).split(",");
  for (var grpi = 0; grpi < grp.length; grpi++) {
                if (data.reportjson.hasOwnProperty(grp[grpi]))
                    data.reportjson[grp[grpi]].push([gr.u_location.location_name.toString(),gr.entity_name.toString(), gr.locally_registered_name.toString(), gr.both_names_registered.getDisplayValue().toString(), 
c.join(";"), gr.membership_status_em.getDisplayValue().toString(), gr.legal_status.toString(), gr.legal_status_notes.toString(), gr.limited_liability_em.getDisplayValue(), 
gr.limited_liability_notes.toString(), gr.jurisdiction.location_name.toString(), gr.local_registration_number.toString(), gr.local_registration_number_notes.toString(), 
gr.member_firm_notes.toString(), gr.firm_responsible.getDisplayValue(), gr.ownership.toString(),  gr.control_em.getDisplayValue(), gr.control_notes.toString(),
gr.management.toString(), gr.trading_status_em.getDisplayValue(),  gr.dormant_entity_justification_em.getDisplayValue(), gr.dormant_entity_justification_notes.toString(),
gr.client_facing_em.getDisplayValue(), gr.service_types.getDisplayValue(), a.join(","), gr.eu_eea_audit_firm_to_be_included_in_tp_report.toString(), 
gr.internal_purpose_or_activity_em.getDisplayValue(), gr.type_internal_purpose_or_activity.getDisplayValue(),  gr.include_in_pcaob_report.toString(), 
ad_data[0].join(",") , ad_data[1].join(","), ad_data[2].join(","), ad_data[3].join(","), ad_data[4].join(","), ad_data[5].join(","), ad_data[6].join(","), ad_data[7].join(","), 
ad_data[8].join(","), ad_data[9].join(","), ad_data[10].join(","), ad_data[11].join(","), ad_data[12].join(","),choiceMap[gr.membership_status_em.getDisplayValue().toString()], gr.entity_name.toString()]);
 
            }
 
for(var si1 = 0; si1<data.orderjson.length; si1++){
data.reportjson[data.orderjson[si1]].splice(42, 2);
}
 
Could someone please help with this?
 
Thanks,
Ankita
1 REPLY 1

Slava Savitsky
Giga Sage

Maybe that's because reportjson is not an array?