Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Getting Error Printing Report

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

    Getting Error Printing Report

    Im having trouble with a dialog that is used to print reports, it has worked without problems for a year and now sundenly this error apears

    Errors in: event.AfterValidate code:
    Variable type mismatch: attempt to pass data of type 'P' to argument 'LayoutName ' is of type 'C'.

    I havent changed anithing to this particular dialog,
    re publishing the dialog fixes the problem for a while then it shows up agian after a day or so

    can sombody please help me determine what is happening
    Cheers
    Mauricio


    #2
    Re: Getting Error Printing Report

    does any one knows whats happening
    Cheers
    Mauricio

    Comment


      #3
      Re: Getting Error Printing Report

      We're only guessing unless you show us the code that's causing the trouble.
      -Steve
      sigpic

      Comment


        #4
        Re: Getting Error Printing Report

        I am now having the exact same error with a report that has been working properly for about 6mths this has to be something with a server update issue. Who can we ask at Alpha for help on this. you're error is identical to mine.

        Chad
        Chad Brown

        Comment


          #5
          Re: Getting Error Printing Report

          Let's see now....no responses after 4 days....pretty typical really when what was asked
          show us the code that's causing the trouble.
          was not heeded by either of you! Very hard to help those who don't help the ones who try to help....(now try to say that 3 times fast! :) )
          Mike
          __________________________________________
          It is only when we forget all our learning that we begin to know.
          It's not what you look at that matters, it's what you see.
          Henry David Thoreau
          __________________________________________



          Comment


            #6
            Re: Getting Error Printing Report

            Here is my code that stopped working on the server. However this code does work locally. Mike this is a copy of my post from earlier. Sorry I didn't post it earlier on this thread.

            dim reports as c
            reports = <<%text%
            A5 Sales Aug08|A5 Sales Aug08@[PathAlias.ADB_Path]\bdi tracking.ddd
            A5 Sales Dec08|A5 Sales Dec08@[PathAlias.ADB_Path]\bdi tracking.ddd
            A5 Sales Nov08|A5 Sales Nov08@[PathAlias.ADB_Path]\bdi tracking.ddd
            A5 Sales Oct08|A5 Sales Oct08@[PathAlias.ADB_Path]\bdi tracking.ddd
            A5 Sales Sep08|A5 Sales Sep08@[PathAlias.ADB_Path]\bdi tracking.ddd
            %text%

            Here is the after validate code

            store = CurrentForm.Controls.Store
            reports = CurrentForm.Controls.ReportChoice
            IF eval_valid("store") = .f. Then
            goto skipreport
            end if
            dim filter as c
            dim order as c
            dim filename as c
            Filter = "Store = \""+store+"\""
            Order = ""
            filename = session.session_folder + "tempreport.pdf"
            filename = report.saveas(reports,"pdf",filter,order,filename,.f.)
            if file.exists(filename)
            currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
            end if
            skipreport:
            Chad Brown

            Comment


              #7
              Re: Getting Error Printing Report

              Chad,
              Not one to help much with the webside....but your filter seems off to me (but may just be me!)

              Seems like it should be more like
              Code:
              Filter = "Store = '"+store+"'"
              although the escape backslash could just be throwing me off as I don't use it for this sort of syntax.
              Mike
              __________________________________________
              It is only when we forget all our learning that we begin to know.
              It's not what you look at that matters, it's what you see.
              Henry David Thoreau
              __________________________________________



              Comment


                #8
                Re: Getting Error Printing Report

                I am almost certain that the code isnt responsible for the error
                but here it is (very similar to yours in concept):

                Activate event:
                dim reporte2 as c
                reporte2 = <<%text%
                Informe Ejecutivo (mes anterior)|Proyectos_Informe_Ejecu@[PathAlias.ADB_Path]\set_proyectos_todo.set
                Informe de Proyectos Etrategicos|Proyectos_Estrategicos@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Gant Multi-Proyectos|Proyectos_Gant_Proyectos@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Indicadores de Proyectos|Proyectos_Indicadores@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Resumen de Ingenierias|Resumen_Ingenierias@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Resumen de Ppto para Ingenierias|Proyectos_Res_Ing_Dpt@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Listado de Ingenierias|Proyectos_Lista_Ing_Dpt@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Listado de Proyectos|Proyectos_Ppto08(tipo)@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Avance de Ingenierias (x Depto)|Avance_ Inges(Depto)@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Avance de Ingenierias (x Planta)|Avance_Inges(Planta)@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Avance de Proyectos (Mes Actual)|Avance_Proyectos_Actual@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Avance de Proyectos (Mes Anterior)|Avance_Proyectos_Past@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Avance de Proyectos (x Planta)|Avance_Proyectos_plant@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Resumen Ejercido Mensual (x Depto)|Financiero_mensual_dpt@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Resumen Ejercido Mensual (x Planta)|Financiero_mensual_pta@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Resumen Financiero (x Depto)|Proyectos_Finan_Res_dpt@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Resumen Financiero (x Planta)|Proyectos_Finan_Res_pta@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Resumen Financiero (x Planta - Tipo)|Proyectos_Finan_Res_P-T@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Detalle Financiero (x Depto) |Proyectos_Financiero_Dpt@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Detalle Financiero (x Planta)|Proyectos_Financiero_Plt@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Detalle Financiero y Avance (x Planta)|Proyectos_Financiero_Avn@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Detalles de Proyectos|Proyectos_Finan_Coment@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Resumen de CarryOver Solicitado|Proyectos_Finan_Res_CO@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Detalle de CarryOver Solicitado|Proyectos_Financiero_CO@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                Presupuesto Actual (Resumen)|Proyectos_carryover_RES@[PathAlias.ADB_Path]\set_proyectos_carryover.set
                Proyectos Cancelados|Proyectos_carryover_canc@[PathAlias.ADB_Path]\set_proyectos_carryover.set
                Proyectos Feura de Presupuesto|Proyectos_carryover_FPTO@[PathAlias.ADB_Path]\set_proyectos_carryover.set
                DEBUG|DEBUG@[PathAlias.ADB_Path]\set_proyectos_reportes.set
                %text%




                After validate event:
                'Creado por: Mauricio Maisterrena
                'Fecha de Creacion: 15-02-2007
                'Fecha de modificacion: 18-07-2007
                '----------------------------------------------------

                '.............
                session.error_reportes="1 "+CurrentForm.Controls.reporte
                '............

                'Variables
                'reporte=convert_type(CurrentForm.Controls.Reporte,"c")
                Tiempo= time("dd-MM-yyyy 0h.0m AM")
                Nombre_reporte="AI-Reporte Proyectos ("+Tiempo+")"
                todo="todo"

                true=".t."

                '.............
                session.error_reportes="2 "+CurrentForm.Controls.reporte
                '............

                'Filtros

                planta=CurrentForm.Controls.Planta
                if CurrentForm.Controls.Planta ="(todas)"
                planta1="<>"+s_quote(todo)
                else
                planta1="="+s_quote(planta)
                end if

                planta=CurrentForm.Controls.area
                if CurrentForm.Controls.area ="(todas)"
                area1="<>"+s_quote(todo)
                else
                area1="="+s_quote(area)
                end if

                Departamento=CurrentForm.Controls.Departamento
                if CurrentForm.Controls.Departamento ="(todos)"
                Departamento1="<>"+s_quote(todo)
                else
                Departamento1="="+s_quote(Departamento)
                end if

                Proyecto=CurrentForm.Controls.Proyecto
                if CurrentForm.Controls.proyecto ="(todos)".or.CurrentForm.Controls.proyecto =""
                Proyecto1="<>"+s_quote(todo)
                else
                Proyecto1="="+s_quote(Proyecto)
                end if

                incluir_carry_over=CurrentForm.Controls.incluir_carry_over
                if CurrentForm.Controls.incluir_carry_over = "FALSE"
                carry_over = "carry over"
                incluir_carry_over1=".and..not.(clase="+quote(carry_over)+")"
                else
                incluir_carry_over1=""
                end if

                incluir_carry_over=CurrentForm.Controls.en_presupuesto
                if CurrentForm.Controls.En_Presupuesto = "FALSE"
                ppto="en ppto"
                En_Presupuesto1=".and..not.(clase="+quote(ppto)+")"
                else
                En_Presupuesto1=""
                end if

                incluir_carry_over=CurrentForm.Controls.Fuera_de_Presupuesto
                if CurrentForm.Controls.Fuera_de_Presupuesto = "FALSE"
                fuera="fuera de ppto"
                Fuera_de_Ppto1=".and..not.(clase="+quote(fuera)+")"
                else
                Fuera_de_Ppto1=""
                end if

                RESPONSABLE=CurrentForm.Controls.RESPONSABLE
                if CurrentForm.Controls.RESPONSABLE ="(todos)"
                RESPONSABLE1="<>"+s_quote(todo)
                else
                RESPONSABLE1="="+s_quote(RESPONSABLE)
                end if

                COORDINADOR=CurrentForm.Controls.COORDINADOR
                if CurrentForm.Controls.COORDINADOR ="(todos)"
                COORDINADOR1="<>"+s_quote(todo)
                else
                COORDINADOR1="="+s_quote(COORDINADOR)
                end if


                '.............
                session.error_reportes="3 "+CurrentForm.Controls.reporte
                '............


                'Descicion al seleccionar "Marcados"
                marcados=CurrentForm.Controls.marcados
                if CurrentForm.Controls.marcados = "FALSE"


                '.............
                session.error_reportes="4 "+CurrentForm.Controls.reporte
                '............

                'Codigo para generar reporte
                IF eval_valid("planta") = .f. Then
                goto skipreport
                end if
                dim filter as c
                dim order as c
                Filter = "planta"+planta1+".and.area"+area1+".and.Depto_Respondsable"+Departamento1+".and.no_proyecto"+proyecto1+".and.jefe_de_proy"+Coordinador1+".and.EJECUTOR"+RESPONSABLE1 + incluir_carry_over1 + en_presupuesto1 + fuera_de_ppto1 + ".and.activo=.t."
                '.............
                session.error_reportes="5 "+CurrentForm.Controls.reporte
                '............

                Dim filename as c
                filename = session.session_folder + chr(92) + Nombre_Reporte + "." +alltrim(formato)
                filename = report.saveas(CurrentForm.Controls.Reporte,alltrim(formato),filter,"",filename,.f.)
                if file.exists(filename)
                currentform.RedirectTarget = session.session_url + Nombre_Reporte + "." +alltrim(formato)+"?" + time("hms3")
                end if
                skipreport:


                '.............
                session.error_reportes="6 "+CurrentForm.Controls.reporte
                '............


                else

                IF eval_valid("planta") = .f. Then
                goto skipreport2
                end if
                dim filter as c
                dim order as c
                Filter = "planta"+planta1+".and.area"+area1+".and.Depto_Respondsable"+Departamento1+".and.no_proyecto"+proyecto1+".and.jefe_de_proy"+Coordinador1+".and.EJECUTOR"+RESPONSABLE1+incluir_carry_over1 +en_presupuesto1 +fuera_de_ppto1+".and.marcado=.t."+".and.activo=.t."

                '.............
                session.error_reportes="7 "+CurrentForm.Controls.reporte
                '............

                Dim filename as c
                filename = session.session_folder + chr(92) + Nombre_Reporte + "." +alltrim(formato)
                filename = report.saveas(CurrentForm.Controls.Reporte,alltrim(formato),filter,"",filename,.f.)
                if file.exists(filename)
                currentform.RedirectTarget = session.session_url + Nombre_Reporte + "." +alltrim(formato)+"?" + time("hms3")
                end if
                skipreport2:

                end if


                '.............
                session.error_reportes="8 "+CurrentForm.Controls.reporte
                '............

                ----------------end-----------------------------

                the session.error_reportes is just a variable for tracking errors
                Cheers
                Mauricio

                Comment


                  #9
                  Re: Getting Error Printing Report

                  as chadbrown said I think the problem is in the WAS
                  Cheers
                  Mauricio

                  Comment


                    #10
                    Re: Getting Error Printing Report

                    This is my newer post on the same subject:

                    I have a web application that can print pdf reports from the web and export data to excel too, but I keep geting the next error messages: (if one of this occurs all of the others occur too).

                    1 In a page for printig reports i get:
                    Errors in event: event.AfterValidate code:
                    Variable type mismatch: attempt to pass data of type 'P' to argument 'Layout name' is of type 'c'

                    2 In a diferent link that redirects you to a page that has code to print 1 specific report i get:
                    Ayumni low level printing

                    3 In a page that is used to exprot data to excel i get
                    tbl_proyecto_set.set unknown dos Error

                    the strangest thing is that republishing etheir one of this pages will correct the error teporarly until something (wich i cant figure out) triggers the error again.

                    Please help me solve this error or to find out what is causing this. crazy ideas are acepted, I have looked every where and i cant find nothing, this pages worked fine 2 months ago and nothing on them has changed since then.
                    Cheers
                    Mauricio

                    Comment


                      #11
                      Re: Getting Error Printing Report

                      I have detected when theb error ocurs it ocurrs whithin this 2 lines of code

                      filename = session.session_folder + char(92) + Nombre_Reporte + "." +alltrim(formato)
                      filename=report.saveas(CurrentForm.Controls.Reporte,alltrim(formato),filter,"",filename,.f.)

                      Im guessing that somthing is wrong with the session.session_folder function but i cant prove it

                      Please help
                      Cheers
                      Mauricio

                      Comment


                        #12
                        Re: Getting Error Printing Report

                        Jerry Brightbill fron the alpha team has solved my problem, thank you Jerry

                        here is his response to my bug report:

                        Mauricio
                        I can duplicate the problem immediately. It should always happen, and is not a bug. The fact that it sometimes works is a surprise, as it should never work

                        The reason is simple, but also a very common mistake.

                        You reference the value returned from the "reporte" dropdown with

                        CurrentForm.Controls.reporte

                        However, this variable is actually a pointer variable of type "p" which is why you are getting the error

                        Variable type mismatch: attempt to pass data of type 'P' to argument 'LayoutName ' is of type 'C'
                        There are a couple ways to reference the value coming back from the submit.

                        1. The value is actually sent back as a request variable, so referencing the request variable would be one method

                        filename = report.saveas(request.variables.Reporte,alltrim(formato),filter,"",filename,.f.)

                        Very few people use this method as they are not aware it exists

                        2. When a request variable is created, a regular character variable of the same name is also created. So checking the value of the variable "Reporte" will also work

                        filename = report.saveas(Reporte,alltrim(formato),filter,"",filename,.f.)

                        This may be the most common way to capture the value, but both of the above potentially have a problem. They work fine with a dropdown, but if you change the control to a radio button, and don't select anything, the browser does not send any variable with the name of the control to the server. In that case, both of the methods above will generate an error as 'request.variables.reporte' does not exist, and the variable 'reporte' does not exist.

                        3. The method you used is also very common, but has an interesting problem, which you have found.

                        CurrentForm.Controls.<controlname> is a pointer variable, but contains a character value. If you output the value as you have done with

                        session.error_reportes="1 "+CurrentForm.Controls.reporte

                        it will return the correct value. By adding any character string to the value, it is converted to character type. But in your code, you just used

                        filename = report.saveas(CurrentForm.Controls.Reporte,alltrim(formato),filter,"",filename,.f.)

                        If you did this instead, you will not get any error, as adding the empty string to the variable changes its type to "C"

                        filename = report.saveas(""+CurrentForm.Controls.Reporte,alltrim(formato),filter,"",filename,.f.)

                        4. The proper way to reference the value is to use

                        CurrentForm.Controls.Reporte.value

                        Unfortunately, this no longer shows up in autocomplete. Actually, it is also very good practice to trim any leading or trailing spaces with

                        alltrim(CurrentForm.Controls.Reporte.value)

                        filename = report.saveas(alltrim(CurrentForm.Controls.Reporte.value),alltrim(formato),filter,"",filename,.f.)

                        This will always give the correct type and value for any single select field or a type in field. The advantage over using request variables is that the code will create the CurrentForm.Control variable even if the browser did not send any value. So 'CurrentForm.Controls.Reporte.value' will always exist.

                        What is confusing is the program will often automatically change a variable to the type needed to evaluate an expression. So something like

                        if CurrentForm.Controls.incluir_carry_over = "FALSE"

                        works fine as the type of the variable doesn't really matter. However, code such as the following may be unreliable as the data type is ambiguous

                        incluir_carry_over=CurrentForm.Controls.en_presupuesto

                        The variable 'incluir_carry_over' may be character or it may take on the type of "p" from ' CurrentForm.Controls.en_presupuesto'. To add to the confusion, if you trim the pointer variable, its type changes to character (assuming it has a single value)

                        So

                        CurrentForm.Controls.Reporte

                        is a pointer "p" and

                        alltrim(CurrentForm.Controls.Reporte)

                        is a character "c".

                        This is also acceptable and is a common method used. Since it "hides" the fact that 'CurrentForm.Controls.Reporte' is actually a pointer, most developers who trim the value are completely unaware of the problem.

                        5. This brings up another method. Some developers get around the problem by creating local character variables in the code and then populating them with the CurrentForm.controls values

                        dim vreporte as c
                        vreporte = CurrentForm.Controls.Reporte

                        Since vreporte was dimmed as character, it will remain as character.

                        In conclusion I suggest the following possible fixes.

                        1. The easiest is just to add alltrim() around every variable referenced as CurrentForm.Control.<ControlName>

                        alltrim(CurrentForm.Controls.Reporte)

                        2. The most correct is to use the value parameter and alltrim

                        alltrim(CurrentForm.Controls.Reporte.value)

                        Jerry Brightbill
                        Cheers
                        Mauricio

                        Comment

                        Working...
                        X