Editor Server Side - How do i ignore a Field

Editor Server Side - How do i ignore a Field

david.j.meyer2@boeing.comdavid.j.meyer2@boeing.com Posts: 54Questions: 15Answers: 0
edited September 2023 in Editor

Link to test case: N/A
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

In the javascript i have a column defined as

                    { data: "NEW_ITEM", defaultContent: ''  },

On the server side i have the following call to the editor.

                        response = new Editor(db, Instance, new[] { "UNIT", "PRECID", "SRECID", "SUPPLIER" }).Debug(true)
                            .Model<CSDTMOD>()
                                .Field(new Field("NEW_ITEM").Set( // Exclude the "NEW_ITEM" field
                                .Set(false)) // Set it to be ignored
                            .Process(request)
                            .Data();

The field "NEW_ITEM" does not exist in CSDTMOD or in the table on the database. We are inserting a value on the client side using jquery for each row.
I was under the impression .Set(false) would tell the editor to ignore the field and not include it in the query. Any suggestions on how to resolve this?

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Replies

  • david.j.meyer2@boeing.comdavid.j.meyer2@boeing.com Posts: 54Questions: 15Answers: 0
    edited September 2023
    response = new Editor(db, Instance, new[] { "UNIT", "PRECID", "SRECID", "SUPPLIER" }).Debug(true)
    .Model<CSDTMOD>()
    .Field(new Field("NEW_ITEM").Set( // Exclude the "NEW_ITEM" field
    .Set(false)) // Set it to be ignored
    .Process(request)
    .Data();
    

    Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

  • david.j.meyer2@boeing.comdavid.j.meyer2@boeing.com Posts: 54Questions: 15Answers: 0

    { data: "NEW_ITEM", defaultContent: '' },

  • allanallan Posts: 61,787Questions: 1Answers: 10,115 Site admin

    There is something funny with your syntax on lines 3/4. Reformatting shows:

    .Field(
      new Field("NEW_ITEM")
        .Set(.Set(false)) 
    

    It should be:

    .Field(
      new Field("NEW_ITEM")
        .Set(false)
    ) 
    

    Maybe it was just a copy / paste error. However, that will exclude the NEW_ITEM field from INSERT and UPDATE queries. If it doesn't exist in the table then you will want to disable it for SELECT queries as well:

    .Field(
      new Field("NEW_ITEM")
        .Get(false)
        .Set(false)
    ) 
    

    But at that point I'm not clear on why you'd have that field on the server-side at all?

    Allan

Sign In or Register to comment.