0

I have an existing object called unsettled:

var unsettled =
    {
        processor: 1,
        dayFrom: 10,
        dayTo: 12
    }

Im trying to add an object called pName as I do with Angular, but it is not working.

unsettled.pname = "something"

It does work if unsettled.pname already exists on the object, but not if I want to create it.

Also, after a sql Query where I get several results, I need to create an array. Same thing, when I do

const pool = await utils.poolPromise
        const recordset = await pool.request()
            .query(sqlString)
        if (recordset.rowsAffected[0] > 0) {
            unsettled.processors = recordset.recordset;
        }

Is not working either (the array processors is not being created).

Thanks.

1 Answer 1

2

For the array, try:

    if (recordset.rowsAffected[0] > 0) {
        unsettled["processors"] = recordset.recordset;
    }

As for as pName, please try

unsettled["pname"] = "something"
Sign up to request clarification or add additional context in comments.

1 Comment

It worked. Thanks Daniele.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.