Adding Custom Form to Report!!

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

  • Adding Custom Form to Report!!

    I've got a few custom forms I have created that the operators fill out before they start the program, I would like to add the forms to my report after they have filled all the fields in, any ideas on how I can add the froms to the report/output?

  • #2
    Hi,
    As far as I know, you cannot insert the form as an object inside any report. The form is a report object itself. But you can insert the values got from the operators answers. You can do something like this:

    CS1 =FORM/FILENAME= C:\USERS\ACUENCA\DESKTOP\FORM1.FORM
    PARAM/EDITBOX1.TEXT=VAR1
    PARAM/=
    ENDFORM/
    COMMENT/REPT,
    "To the question in the form, the operator answered = " + VAR1

    Please look to the param line. You are asigning the value of the object editbox1 (from the form) to the variable Var1. Then you use this variable into a report command.
    when you refresh your report the comment will appear with the value
    Hope this helps

    Comment


    • #3
      Yeah I made an .rtp form or whatever the report form format is, but for some reason I cant get my variables to transfer into the fields I have created, do I need "Edit" in front of my field name. Also what should I use to create my boxes in the .rtp form? say my fields box is usernamebox i code usernamebox.text=Var1 do i need editusernamebox.text=var1? made the field I'm trying to use is wrong

      Comment


      • #4
        Hi,
        The extensión for forms is .form.
        Each object you put in your form has a name. If you edit your form, do right click over the object where the operator will write the answer. Depending on the object type it will have a different name. If it's a text object, the name will be text? where ? Is a number. To recall the value that operator writes in execution time, you need to call the object.text property in the param line.
        Let's try to see with an example: You create a new form. In the object bar you will see there are some kind of different objects. Insert a editbox. When inserted, if you right click over, the properties page will open. In the top you will see the object name. It should be (if it's the first) editbox1
        So, the property that contains the text that the operator will write in execution is the property called text of the object editbox1
        So, to call the value you should write editbox1.text
        To get the value in the partprogram, you should assign to a variable in the param line.
        Then you can use the variable along the parprogram for any purpose you need, in the example is used to display a value in the report.

        You can have param lines as much as you need an transfer "unlimited" parameters.

        Please let me know if it's not still clear.
        Regards

        Comment


        • #5
          Antonio, your post was helpful to me as I am trying to figure out how to display a "status" dialog box. We run a group of parts on multi-part fixtures and I would like to have a dialog box that displays which number part its on. I was able to figure this out with pcdmis form functions, but it I have these problems:
          1) When it gets to the form command, the program is stopped until the Continue button is clicked. I want ti to continue to run without pausing.
          2) On following parts, the form does not display until the loop brings it back to the form command.

          I want a form on continuous display, showing the progress of the multi=part run and a foem that does not halt the program.
          Is there anyway for pcdmis forms to be made to be used like I want, or do I have to look into using an independent VB form?
          "It ain't those parts of the Bible that I can't understand that bother me, it is the parts that I do understand." Mark Twain

          Comment


          • #6
            Hi, A form command will always stop the partprogram execution, so no way.
            Which PCMDIS version are you using? Depending on the version maybe you can have another chance:
            Maybe you can try sending comment commands to readout window. If you have the readouts windows open while executing the partprogram, you can visualize there the texts.....
            Yo can program as well an independent VB form from Visual Basic .NET, etc. but this would be a hard work.... :-)

            Comment


            • #7
              Originally posted by Antonio.Cuenca View Post
              Hi, A form command will always stop the partprogram execution, so no way.
              Which PCMDIS version are you using? Depending on the version maybe you can have another chance:
              Maybe you can try sending comment commands to readout window. If you have the readouts windows open while executing the partprogram, you can visualize there the texts.....
              Yo can program as well an independent VB form from Visual Basic .NET, etc. but this would be a hard work.... :-)
              I have 2012. I'm holding the possibility of using the readout window - but its not my 1st choice since we don't customarily display it.
              Yeah the vb form method is proving pretty stubborn. It does not seem possible to pass a variable direct to a vb form.
              Right now I'm looking into writing to a text file from pcdmis (I know that already) and then having a vb form that is called from pcdmis read the text file. Having trouble finding an easy way for vb to read the text file right now though!
              "It ain't those parts of the Bible that I can't understand that bother me, it is the parts that I do understand." Mark Twain

              Comment


              • #8
                Wich VB version are you using? If VB6 you can do somenting like this:

                Dim VarFileName as string
                Dim StrInput(1000) as string
                Dim IntCounter as integer

                intcounter = 1

                on error resume next

                Open VarFileName for input as #1

                Do
                Line input #1, StrInput(intcounter)
                intcounter = intcounter +1
                Loop while not eof(1)

                close #1

                You can have problems if PCDMIS and VB try to access the file at the same time. To avoid this problems I put the line on error resume next.


                Then you have a variable matrix called strinput on each element contains a line of the file.

                Hope this helps.

                Comment


                • #9
                  I have vb 6 (because of MeasureMax).
                  I already found some code that does the trick, but thanks for offering your code:
                  Code:
                  '--- below re always on top
                  Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
                  Private Const SWP_NOSIZE = &H1
                  Private Const SWP_NOMOVE = &H2
                  Private Const HWND_TOPMOST = -1
                  Private Const HWND_NOTOPMOST = -2
                  Sub Main()
                  Dim nFileNum As Integer, sText As String, sNextLine As String, lLineCount As Long
                  
                  nFileNum = FreeFile ' Get a free file number
                  
                  Open "C:\pcdmisSCRIPTS\PRGprogress\donesofar.txt" For Input As nFileNum ' Open a text file for input. inputbox returns the path to read the file
                  
                  lLineCount = 1
                  
                  Do While Not EOF(nFileNum) ' Read the contents of the file
                     Line Input #nFileNum, sNextLine 'do something with it
                     sNextLine = sNextLine & vbCrLf  'add line numbers to it, in this case!
                     sText = sText & sNextLine
                  Loop
                  Form1.Label2.Caption = sText 'Display the content in the text box
                  
                  ' Close the file
                  Close nFileNum
                  
                  Call statusform
                  End Sub
                  Sub statusform()
                  If Form1.Visible = True Then
                  Set Form1 = Nothing
                  'Unload Me
                      Unload Form1
                  End If
                  
                  Call SetFormOnTop(Form1)
                  Form1.Show vbModal
                  End Sub
                  Sub SetFormOnTop(myForm As Object)
                          SetWindowPos Form1.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
                  End Sub
                  This is how I call the vb routine:
                  Code:
                              ASSIGN/QTYTODO=2
                              ASSIGN/QTYDONE=0
                  L1         =LABEL/
                              ASSIGN/QTYDONE=QTYDONE+1
                              ASSIGN/QTYDONE=QTYDONE
                  FPTR       =FILE/OPEN,C:\PCDMISSCRIPTS\PRGPROGRESS\DONESOFAR.TXT,WRITE
                              FILE/WRITELINE,FPTR,QTYDONE
                              FILE/CLOSE,FPTR,KEEP
                              EXTERNALCOMMAND/NO_DISPLAY, NO_WAIT ; C:\pcdmisSCRIPTS\PRGprogress\PRGprogress.EXE
                              COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                              did it run this too?
                              IF/QTYDONE<QTYTODO
                              GOTO/L1
                              END_IF/
                  Of course the above pcdmis code is just for testing.
                  My remaining problem is that I end up with a new window everytime I loop through it. My next challenge is to find a code example of how to detect if the window is open and close it if it is, just before opening the next window.
                  "It ain't those parts of the Bible that I can't understand that bother me, it is the parts that I do understand." Mark Twain

                  Comment


                  • #10
                    Originally posted by Kevo_cmm View Post
                    I want a form on continuous display, showing the progress of the multi=part run and a foem that does not halt the program.
                    Is there anyway for pcdmis forms to be made to be used like I want, or do I have to look into using an independent VB form?
                    Under the F5 edit there is a pull down in the middle, toward the bottom of the list is a checkbox for Update Report During Execution, when this is checked the program will update while running and after each feature is measured the report will update the dimensions and you can see it while running.

                    Hope this helps
                    sigpic "Marine" ... a title that is earned by few........never given.

                    Comment


                    • #11
                      Originally posted by D-Train View Post
                      Under the F5 edit there is a pull down in the middle, toward the bottom of the list is a checkbox for Update Report During Execution, when this is checked the program will update while running and after each feature is measured the report will update the dimensions and you can see it while running.

                      Hope this helps
                      What version is this I got 4.3 and I can't find it
                      sigpicSTANDING CORRECTED IS THE ONLY WAY I STAND

                      Comment

                      Related Topics

                      Collapse

                      Working...
                      X