Home Image-Pro Automation (Macros, Apps, Reports)

Report with 2 fields on one line

How do I make a report where there are 2 field on one line? and a text field where users can write ?Re

Answers

  • edited August 2014
    Hello,

    The trick is to use "Convert to Paragraphs". To do this, place the cursor on one of the data lists (in this case it would be easier to start with just one list with the 2 measurements) and then go to the List tab on the ribbon. Once the list is converted to a paragraph you can move things around as you wish.

    image

    As for the text box, it looks like you found one way to do this. Then the user has to use "Edit Report" on the Share tab and can add extra information to the report. If you'd rather have the user be prompted you can do this with a macro, is this what you are looking for?

    Pierre
  • If a prompt is required, here is the simplest method to achieve this.
    1. Insert a DOCVARIABLE field anywhere you like in the report, this field will be replaced with a prompted value at run-time. In order to insert the field, just click Ctrl+F9, the field symbol {} will appear with the insertion cursor in the middle. Then enter the following { DOCVARIABLE "Field1" }, you can then switch back to viewing the field results on the View tab.
    2. Switch to code view and implement 2 events as illustrated in the code sample below. After this is done, every time the report template is used, the user will be prompted for the value of Field1.
    Public Class Report1
    
        Private _field As String = "default"
        Private _prompt As Boolean = False
    
        Private Sub ThisReport_BeforeReport(ByVal source As Object, ByVal args As MediaCy.Addins.Reporter.ReportEventArgs) Handles ThisReport.BeforeReport
            _prompt = True
        End Sub
    
        Private Sub ThisReport_CalculateField(ByVal source As Object, ByVal args As MediaCy.Addins.Reporter.CalculateFieldEventArgs) Handles ThisReport.CalculateField
            If args.FieldName = "Field1" Then
                If _prompt Then
                    _prompt = False
                    _field = InputBox("Please enter value for field " & args.FieldName,args.Report.DisplayName,_field)
                End If
                args.Value=_field
                args.Handled=True
            End If
        End Sub
    
    End Class
    
  • I have tried to change it to paragraphs, but I cannot save the report!
    maybe something is wrong with my installation?
  • If you are running version 9.1.2, I don't see any reason why you couldn't save. Save is in the File menu in Project Workbench, but you can also use Ctrl+S.

    image
  • As always, just restart your computer ad you are up running. It works now.
    I will play a little with it and let you know how it goes!
  • Hi Pierre!

    where do I make the code in the example to create the user promt?
  • Hi,

    You need to switch to code view, this is done on the View tab, and once in code view click Edit to change the code.

    Pierre
Sign In or Register to comment.