locked
Modify Report in .exe? RRS feed

  • Question

  • I have an app where I want the user to be able to modify a report.

    Calling MODIFY REPORT myReport from inside the method works ok in IDE but not in exe.
    I tried the SAVE and IN SCREEN clauses. The Report Controls appear but not the report.
    I also tried to exclude the report (frx) in the project.

    Any other suggestions?

    Steve
    Thursday, March 5, 2020 10:34 PM

Answers

  • I think I solved it. My Main prg had the line

    _SCREEN.Visible = .F.

    which I've always used since I had no apps which allowed user to modify a report.

    This app allows MODIFY on only one report so I set the _SCREEN visible for only that report.

    The screen is now visible when I modify the report in exe, but I'm not sure it will work on a computer without VFP installed. We'll see...

    Steve

    Monday, March 9, 2020 8:42 PM
  • Hi Steve,

    thanks for this info!

    Now that you told us about your solution, I looked into my reportdesigner.exe application just to remember how I did this more than a decade ago :)

    The complete exe file consist of a small prg only, that receives a filename (=reportfile) as parameter.

    LPARAMETERS vFile as String
    
    IF PCOUNT() = 1 AND VARTYPE( m.vFile ) = [C] AND FILE( m.vFile )
    
    	LOCAL lcCurdir
    	lcCurDir = FULLPATH( CURDIR() ) + [;] + FULLPATH( JUSTPATH( m.vFile ) )
    
    	SET PATH TO ( lcCurDir )
    	SET REPORTBEHAVIOR 90
    	SET SYSMENU ON 
    	SET SYSMENU SAVE
    	SET SYSMENU TO _MSM_FILE, _MSM_EDIT, _MSM_FORMAT
    		
    	IF FILE( m.vFile )
    	
    		_screen.Width	= SYSMETRIC( 1 ) / 1.5
    		_screen.Height	= SYSMETRIC( 2 ) - 50
    		_screen.Caption = [Report Administration - Designer]
    		_screen.Icon	= [Reporting.ico]
    		_screen.Visible = .T.
    
    		TRY 
    			KEYBOARD [{CTRL+F10}]
    			MODIFY REPORT ( m.vFile ) NOENVIRONMENT PROTECTED SAVE
    		CATCH
    			TEXT TO lcString NOSHOW TEXTMERGE PRETEXT 2
    				The file  <<GETWORDNUM( JUSTSTEM( m.vFile ) , 2 , [_] )>> in 
    				could not be opened. Perhaps this file is in use
    				for printing the report or is currently modified 
    				by another user.
    			ENDTEXT 
    
    			MESSAGEBOX( lcString , 0 + 16 + 0 , [Report Designer ] )
    		ENDTRY 
    		
    	ENDIF 
    	
    	IF _vfp.StartMode = 0
    		SET SYSMENU TO default
    	ENDIF 
    
    ENDIF 

    As you can see, it is only a small prg but it decouples the editor from the rest of our app which has permanently set _screen.visible = .F.


    Gruss / Best regards
    -Tom
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible,
    you are, by definition, not smart enough to debug it. 010101100100011001010000011110000101001001101111011000110110101101110011



    Tuesday, March 10, 2020 6:14 AM
    Answerer

All replies

  • I have added in apps' folder:

    DO Foxypreviewer.app
    DO ReportBuilder.app

    Menu's calling line:

    ON SELECTION BAR 15 OF Irstax MODIFY REPORT 1099-Manual NOENVIRONMENT PROTECTED SAVE

    Still no report shows.

    Steve

    Thursday, March 5, 2020 11:38 PM
  • Hi Steven,

    Version #1

    is the report part of your project and eventually INCLUDED (which is the regular way for most project files)?

    If so, then editing won't be able without saving the included report to disk. However, excluding the report and making it a part of your install routine might be a better option.

    BTW this is the way we are working for decades. But as we have 50+ different kind of reports and each report type can have up to 99 different variants that can be created by our cutsomers on the fly for four different reporting engines, we honestly didn't have another chance :) :)

    Version #2

    the report is excluded and available as a seperate file, then you have to check, how the user accesses this file. Is it a file server installation or RDP or local?

    In every case, check out, that antivirus doesn't interfere with your report directory. In case of a file server some firewall rules might be an additional reason. And even bad network speed can lead to some problems.

    HTH


    Gruss / Best regards
    -Tom
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible,
    you are, by definition, not smart enough to debug it. 010101100100011001010000011110000101001001101111011000110110101101110011

    Friday, March 6, 2020 7:40 AM
    Answerer
  • Thanks, Tom,

    The report is excluded from the project. Turning off virus protection had no effect.

    The report's frx is on my own computer (Win10,VFP9SP2) in the same writable folder as the project.

    The report controls appear and the main form freezes. I have to use the task manager to end task.

    It's one of several reports, but the only one I want the user to modify. The others appear ok with the REPORT FORM command.

    I thought it might be a problem with that frx, so I tried the MODIFY REPORT command on another report after excluding it from the project. Same result.

    Steve

    Friday, March 6, 2020 5:16 PM
  • I think I solved it. My Main prg had the line

    _SCREEN.Visible = .F.

    which I've always used since I had no apps which allowed user to modify a report.

    This app allows MODIFY on only one report so I set the _SCREEN visible for only that report.

    The screen is now visible when I modify the report in exe, but I'm not sure it will work on a computer without VFP installed. We'll see...

    Steve

    Monday, March 9, 2020 8:42 PM
  • Hi Steve,

    thanks for this info!

    Now that you told us about your solution, I looked into my reportdesigner.exe application just to remember how I did this more than a decade ago :)

    The complete exe file consist of a small prg only, that receives a filename (=reportfile) as parameter.

    LPARAMETERS vFile as String
    
    IF PCOUNT() = 1 AND VARTYPE( m.vFile ) = [C] AND FILE( m.vFile )
    
    	LOCAL lcCurdir
    	lcCurDir = FULLPATH( CURDIR() ) + [;] + FULLPATH( JUSTPATH( m.vFile ) )
    
    	SET PATH TO ( lcCurDir )
    	SET REPORTBEHAVIOR 90
    	SET SYSMENU ON 
    	SET SYSMENU SAVE
    	SET SYSMENU TO _MSM_FILE, _MSM_EDIT, _MSM_FORMAT
    		
    	IF FILE( m.vFile )
    	
    		_screen.Width	= SYSMETRIC( 1 ) / 1.5
    		_screen.Height	= SYSMETRIC( 2 ) - 50
    		_screen.Caption = [Report Administration - Designer]
    		_screen.Icon	= [Reporting.ico]
    		_screen.Visible = .T.
    
    		TRY 
    			KEYBOARD [{CTRL+F10}]
    			MODIFY REPORT ( m.vFile ) NOENVIRONMENT PROTECTED SAVE
    		CATCH
    			TEXT TO lcString NOSHOW TEXTMERGE PRETEXT 2
    				The file  <<GETWORDNUM( JUSTSTEM( m.vFile ) , 2 , [_] )>> in 
    				could not be opened. Perhaps this file is in use
    				for printing the report or is currently modified 
    				by another user.
    			ENDTEXT 
    
    			MESSAGEBOX( lcString , 0 + 16 + 0 , [Report Designer ] )
    		ENDTRY 
    		
    	ENDIF 
    	
    	IF _vfp.StartMode = 0
    		SET SYSMENU TO default
    	ENDIF 
    
    ENDIF 

    As you can see, it is only a small prg but it decouples the editor from the rest of our app which has permanently set _screen.visible = .F.


    Gruss / Best regards
    -Tom
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible,
    you are, by definition, not smart enough to debug it. 010101100100011001010000011110000101001001101111011000110110101101110011



    Tuesday, March 10, 2020 6:14 AM
    Answerer
  • Thanks, Tom. I used your good idea of changing screen properties to fit the report. :)

    Steve

    Wednesday, March 11, 2020 12:36 PM