• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Edit Grid Validation - trying to set fields to a value on the add and the update

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

  • Edit Grid Validation - trying to set fields to a value on the add and the update

    New to NAB and in the validation program for the Edit grid, I'm trying to set fields in the record to a value on the add and the update. These fields are not on the grid. The fields are actually the current date, current time and user but they are fields in the record I am updating in the file . Does that make a difference - do the fields need to be on the grid?

    Thanks in advance

    Ruth Ann

  • #2
    For special "behind the scenes" editing/initializing functions you would want to create a simple back-end RPG validation program, modeled after the EXNABVAL source supplied with Valence.

    In your particular case, you'd want to use the SetValue(filename:fieldname:value) procedure for each of the fields you want to initialize. This should be placed inside the ProcessAdd procedure. It is not required that the fields being set exist in the grid or even in the underlying data source.

    Note that value is always passed into the SetValue() procedure as a character field, regardless of the type of field you're setting -- i.e., it'd be '2022-01-20' for a date, '14.55.00' for a time, '123' for a number, etc.

    Comment


    • #3
      Thanks. I am still doing something wrong.

      p ProcessAdd b
      d pi
      /free

      SetValue('N4tiet':SM73MZ5:'RuthAnn');

      N4TIET is my filename. SM73MZ5 is my field name and 'RuthAnn' is my value and it's not updating. I've tried with no single quotes around the filename and that is the only way I can get a clean compile. Any ideas?

      Thanks

      Comment


      • #4
        Have you tried SetValue('N4TIET':'SM73MZ5':'RUTHANN'); ?

        Or is SM73MZ5 a variable?

        Comment


        • #5
          Tried that too and SM73MZ5 is a variable . it's the fieldname in my file. I've defined the field name too and tried it with and without the quotes and still no updating the field

          Comment


          • #6
            Something else must be wrong then. Please send an email to CNX support and someone will arrange to look at it with you.

            Comment


            • #7
              Worked with Sean in Support and the filename needs to be UPPPER CASE. In the example, it is specified uppercase but I never did do the upper case. Thanks Sean

              Comment


              • #8
                Little late in getting back to this but.... I'm trying to populate eight fields in my processAdd routine and four fields in my processEdit routine. Only the first four get populated in the processAdd routine. The same four fields are not getting populated. I've triple0chcked to make sure the fieldnames are correct. Any ideas?

                p ProcessEdit b
                d pi
                /free

                SetValue('N4TIET':'SM73MZ3':'VALAPP');
                SetValue('N4TIET':'SM73MYZ':'N4TJ1F');
                SetValue('N4TIET':'SM73MZB':%char(%date()));
                SetValue('N4TIET':'SM73MZ9':%char(%time()));

                /end-free
                p e

                Comment


                • #9
                  Never mind......... The snow must have gotten to my head

                  Comment

                  Working...
                  X