Announcement

Collapse
No announcement yet.

how to insert null instead of 0 for integer data type?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to insert null instead of 0 for integer data type?

    Hi all,

    Im using scriptcase v8 and oracle as database. When creating a form, i will have items withe integer data type via front end (number in oracle back end). but there are occasions where i don't need this field to be filled yet. i would just like to submit the form and make the field null.

    Currently, every time i leave the item and do not key anything, it will automatically insert value 0. How can i just leave it null and do not enter any value? there must be setting anywhere.

    Thanks

  • #2
    You need to tell the database field in the RDBMS itself (via Database Builder or some other tool) to allow NULL for that field.

    Comment


    • #3
      Originally posted by adz1111 View Post
      You need to tell the database field in the RDBMS itself (via Database Builder or some other tool) to allow NULL for that field.
      null is allowed. my db can accept null..problem is scriptcase keeps inserting value 0 for any integer fields if it is not filled or hidden. i just want to keep it null instead of it inserting 0 value.

      Comment


      • #4
        General Setting for the field:
        Scroll down to Database Value and set Insert and Update to Null.


        If you want to do it by yourself: onBeforeInsert/onBeforeUpdate

        if(empty({your_int_field}))
        {
        {your_int_field} = 'Null';
        }

        jsb
        Last edited by jsbinca; 09-03-2014, 08:40 AM.

        Comment


        • #5
          I had same problem with SC, i created a trigger in table on before insert i valide if is zero then asign value null.

          Comment

          Working...
          X