Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Need to filter fieldvalue from the below

I want to filter the fieldvalue and the length of the filedvalue character greater than 3 from the below array. Please help with this

[
    {
        "fieldName": "",
        "fieldValue": "",
        "OrderbyFieldName": "",
        "OrderbyDesc": false
    },
    {
        "fieldName": "Selection",
        "fieldValue": "b",
        "OrderbyFieldName": "",
        "OrderbyDesc": false
    }
]

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You can use Array.filter to do just that.

const filteredData = data.filter(item => item.fieldValue?.length >= 3);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading