• 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.

[SOLVED] Last parm sent to Valence update pgm is zero.

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

  • [SOLVED] Last parm sent to Valence update pgm is zero.

    Hello,

    I created a maintenance pgm using autocode. The last field coming into the pgm is zero, but data is being sent. Has anyone come across this or is it just me?

    Firebug shows that data is being sent. The field in question is MTDWNENTIM.

    action=updateRecord&pgm=DOMNTDWNR&MTPLANT=OK&MTLIN E=1&MTSHIFT=1&MTREASCOD=1&MTNOTE=Test&MTDWNSTDAT=2 013-12-15&MTDWNSTTIM=1%3A30%20AM&MTDWNENDAT=2013-12-16&MTDWNENTIM=3%3A15%20AM&sid=84F1205C43730C94F309 43D8CF50FD187EBE0FC8B5255424C54C7BEA54D02D5D&app=1 031

    I dumped the program and this field is zero. Also some other date/time fields for comparison.

    POST_MTDWNENDAT DATE(10) '2013-12-16' 'F2F0F1F360F1F260F1F6'X
    POST_MTDWNENTIM TIME(8) '00.00.00' 'F0F04BF0F04BF0F0'X
    POST_MTDWNSTDAT DATE(10) '2013-12-15' 'F2F0F1F360F1F260F1F5'X
    POST_MTDWNSTTIM TIME(8) '00.30.00' 'F0F04BF3F04BF0F0'X

    Here's another problem. On the add window for a record, the date selection popup begins at year 1. And, on the edit window, the time fields do not show what is in the field. They show blanks.

    Found more problems. I'm allowed to select a date field to search, but this does not work. Also, when I click on a time column to sort, all the records disappear from the screen.



    Thanks for any help.
    Last edited by JosephHarriman; 12-18-2013, 10:46 AM.

  • #2
    Hi Joeseph,

    I don't believe we've ever tried using Autocode with time fields, nor searching on date fields (not sure how that would be very useful). In any case, I just set up a quick test and I see what you mean about the time fields behaving weird.

    Someone will look into this and get back to you.

    Rob

    Comment


    • #3
      I went to the output from autocode and was able to modify each time field so that they work with time formatted such as "03:45:05", the key was including the format and the altFormats. In order to have the time field display as "4:00 PM" then additional code would be needed to convert the value to iso like in the file. But including the format and adding H.i.s to the altFormats will stop the code from having errors.

      Code:
      xtype:'timefield',
      id:'edit_CTIME1',
      format : 'H.i.s',
      altFormats : "H.i.s|g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H|gi a|hi a|giA|hiA|gi A|hi A",
      autoCreate:{
          tag:'input',
          maxlength:'8'
      },
      fieldLabel:'TIME 1'

      Comment


      • #4
        To modify the output for future auto code maintenance forms, edit program VVACFMNT in the Valence Library (VALENCE32 by default).

        About line 1470, after this:

        Code:
         when fields(yy).vvFldType=TIMEFIELD;                      
           varyChar+='xtype'+COLON+SQ+'timefield'+SQ+COMMA+CR+LF;
        add:
        Code:
          //add format and altFormats                                     
          %len(varyChar)+=indentStart+4;                                  
          varyChar+='format'+COLON+SQ+'H.i.s'+SQ+COMMA+CR+LF;             
          %len(varyChar)+=indentStart+4;                                  
          varyChar+='altFormats'+COLON+SQ;                                
          varyChar+='H.i.s|g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|';  
          varyChar+='h a|g a|g A|gi|hi|gia|hia|g|';                       
          varyChar+='H|gi a|hi a|giA|hiA|gi A|hi A'+SQ+COMMA+CR+LF;
        before the lines:
        Code:
        when fields(yy).vvFldType=STMPFIELD;                    
          varyChar+='xtype'+COLON+SQ+'textfield'+SQ+COMMA+CR+LF;
        At line 1556, code should be edited so the results are as below. The code is the same:

        Code:
         when fields(yy).vvFldType=TIMEFIELD;                            
          varyChar+='xtype'+COLON+SQ+'timefield'+SQ+COMMA+CR+LF;         
                                                                         
                                                                         
          //add format and altFormats                                    
          %len(varyChar)+=indentStart+4;                                 
          varyChar+='format'+COLON+SQ+'H.i.s'+SQ+COMMA+CR+LF;            
          %len(varyChar)+=indentStart+4;                                 
          varyChar+='altFormats'+COLON+SQ;                               
          varyChar+='H.i.s|g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|'; 
          varyChar+='h a|g a|g A|gi|hi|gia|hia|g|';                      
          varyChar+='H|gi a|hi a|giA|hiA|gi A|hi A'+SQ+COMMA+CR+LF;      
        when fields(yy).vvFldType=STMPFIELD;                             
          varyChar+='xtype'+COLON+SQ+'textfield'+SQ+COMMA+CR+LF;         
        endsl;

        Comment


        • #5
          Thanks Eric,

          A portion was solved. On the add window for a record, the date selection popup still begins at year 1. When I click on a date or time column to sort, all the records still disappear from the screen. I'm still allowed to select a date field to search, but this still does not work.

          Comment


          • #6
            The default values on the form come from a blank data structure, hence the dates of 0001-01-01. This is by design, to allow access in RPG code that you can override the defaults. Maybe you want to set it to today's date.

            The area of the generated output that can be used to override default values is a procedure called SendBackFieldDefaults:

            Code:
             p SendBackFieldDefaults...                                        
             p                 b                                               
             d                 pi                                              
                                                                               
             d record          ds                  likerec(REC)inz             
              /free                                                            
               // set your default values here...                              
               //   record.fieldname = value;                                  
               //                                               
               record.dateField1 = %date();
               record.dateField2 = %date();
                           
               vvOut.success='Y';                                              
               vvOut.object='AAAXXXPF  ';                                      
               vvOut.encodeUTF16='Y';                                          
               vvOut_toJSON(vvOut:%addr(record));                              
              /end-free                                                        
             p                 e

            Comment


            • #7
              Thanks Eric,

              That solved the add window date problem. There was an UPPER on a SQL statement that was preventing the sort by date. So I guess not being able to search by date is not such a big deal anymore.

              Update: I'm now able to search by date. I changed the xtype to datefield and removed the trigger code. It was that simple.
              Last edited by JosephHarriman; 12-31-2013, 09:10 AM.

              Comment

              Working...
              X