Arctic reports (reporting system - Windows)

Developed or developing a new product in PureBasic? Tell the world about it.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Arctic reports (reporting system - Windows)

Post by srod »

Under some circumstances a progress bar will be displayed within the nxReport generated preview window's statusbar. This will happen if generating the thumbnail images for the preview window (if enabled) takes too long (i.e. there are too many pages). These images are generated in the background anyhow. Disabling the generation of thumbnail preview images should avoid all of this.

The thing that can hold up a print or preview is the generation of the underlying 'spoolfile'. This is where all datasources are accessed etc. Now, once this file has been created, previews or prints are pretty much instantaneous. This spoolfile is the bottleneck. Now, you can opt to have this spoolfile created in the background using the \CreateSpoolFileInBackground() report method. This method creates a separate background thread in which the spoolfile is generated. You can do this whilst your app is doing other things. nxReport will send a #nxm_SPOOLFILEFINISHED message to any report callback you have created to tell you when the creation of the spoolfile has completed.

Note that a spoolfile is only recreated if some action has invalidated it. Otherwise, existing spoolfiles are used (and reused) and so this bottleneck can be avoided with some careful planning.

The Pyrex designer does all of this and throws up a dialog if the generation of a preview is taking too long (e.g. some external datasource is playing silly buggers) giving the user the chance to cancel the preview at any time.
I may look like a mule, but I'm not a complete ass.
sphinx
Enthusiast
Enthusiast
Posts: 120
Joined: Thu Oct 26, 2006 6:34 pm
Contact:

Re: Arctic reports (reporting system - Windows)

Post by sphinx »

Hi srod, any update soon? Barcode?!
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Arctic reports (reporting system - Windows)

Post by srod »

Will start a complete rewrite very soon now bringing 64-bit support and code modules. May or may not create a parallel limited edition with cross-platform support as well.

Bar codes... not in the near future I'm afraid.
I may look like a mule, but I'm not a complete ass.
sphinx
Enthusiast
Enthusiast
Posts: 120
Joined: Thu Oct 26, 2006 6:34 pm
Contact:

Re: Arctic reports (reporting system - Windows)

Post by sphinx »

Keep up the great work.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Arctic reports (reporting system - Windows)

Post by srod »

16th January 2013.

Hi,

this is just a bug fix release. Problems with group totals and the like have been fixed as well as a couple of issues with SQLite data sources.

Please note that the Pyrex designer no longer comes in the form of a .msi installer. Instead there is just a .zip archive to extract.

Regards.

Stephen.
I may look like a mule, but I'm not a complete ass.
sphinx
Enthusiast
Enthusiast
Posts: 120
Joined: Thu Oct 26, 2006 6:34 pm
Contact:

Re: Arctic reports (reporting system - Windows)

Post by sphinx »

I am waiting for your road map features ;)

Thanks for the update anyway :D
User avatar
le_magn
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Aug 24, 2005 12:11 pm
Location: Italia

Re: Arctic reports (reporting system - Windows)

Post by le_magn »

Hi Srod, is possible to explain how to select image from database and show in my report?
The Online Manual is too limited and not explain in detail all function... :(
Image
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Arctic reports (reporting system - Windows)

Post by srod »

Certainly. :)

The nxReport core module will take images in a number of ways. You can embed images within a report itself and use a control of type #nxReport_IMAGE or you can use a control of type #nxReport_EXIMAGE which can take images from disc or from a string expression harboring an image encoded in base-64 format.

I would guess that the base-64 encoded images are what you are in need of as you can store these in a database.

For an example of this see the purebasic demo "image2". My advice would be to run the "Demo_CreateSaveImageReport.pb" program directly using the nxReport core DLL etc. in order to create the .nxr report file. Then load this up in Pyrex so that you can see the design of the report and examine the underlying SQLite database in which I have placed some images in base-64 encoding. Pyrex will preview the report no problem.

Below is some code which you can use to create a base-64 encoding of any image. It will place the string on the clipboard which you can then paste into another program which you can hack up to create an SQLite database for example. Comment the END statement in the following code to preview the image from the base-64 string.

Code: Select all

;This little utility returns a base-64 encoded string representing a given image (.bmp, .jpeg or .png).

UseJPEGImageDecoder()
UsePNGImageDecoder()

;Throw up a file requester.
  pattern$ = "Image |*.bmp;*.jpg;*.jpeg;*.png|All files (*.*)|*.*"
  fileName$ = OpenFileRequester("Please choose image file to load", "", pattern$, 0)

If fileName$
  fileSize = FileSize(fileName$)
  If fileSize > 0
    sourceBuffer = AllocateMemory(fileSize)
    If sourceBuffer
      destinationSize = fileSize * 1.4
      destinationBuffer = AllocateMemory(destinationSize)
      If destinationBuffer
        If ReadFile(1, fileName$)    
          ReadData(1, sourceBuffer, fileSize)
          CloseFile(1)
          If Base64Encoder(sourceBuffer, fileSize, destinationBuffer, destinationSize) 
            result$ = PeekS(destinationBuffer, -1, #PB_Ascii)
            SetClipboardText(result$)
          EndIf
        EndIf
        FreeMemory(destinationBuffer)
      EndIf
      FreeMemory(sourceBuffer)    
    EndIf
  EndIf
EndIf

End


;Let's take a look.

If result$
  sourceSize = Len(result$)
  destinationSize = sourceSize * 0.8
  If destinationSize < 64
    destinationSize = 64
  EndIf
  sourceBuffer = AllocateMemory(sourceSize + 1)
  If sourceBuffer
    destinationBuffer = AllocateMemory(destinationSize)
    If destinationBuffer
      PokeS(sourceBuffer, result$, -1, #PB_Ascii)
      Base64Decoder(sourceBuffer, sourceSize, destinationBuffer, destinationSize) 
      CatchImage(1, destinationBuffer)
      FreeMemory(destinationBuffer)
    EndIf
    FreeMemory(sourceBuffer)
  EndIf
EndIf

If IsImage(1)
  If OpenWindow(0, 0, 0, 400, 400, "ImageGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ImageGadget(0,  10, 10, 100, 83, ImageID(1))
  EndIf
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
I hope this helps.
I may look like a mule, but I'm not a complete ass.
User avatar
le_magn
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Aug 24, 2005 12:11 pm
Location: Italia

Re: Arctic reports (reporting system - Windows)

Post by le_magn »

Hi Srod, this resolve my problem... thank you very much!!!!
Image
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 639
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: Arctic reports (reporting system - Windows)

Post by captain_skank »

Got an odd issue which is going to cause a major issue for me.

Tried to create a new report today via PYREX which gets it's data from MySql via and ODBC connection.

The sql builder within pyrex runs the query with no problem and gets / displays the data correctly, however when I display the same data within a report it only shows whole numbers :

E.G 32.36 in mysql is shown as 32.00 in Pyrex/Arctic Reports

I've tried doing this in Pyrex version 1.4.5 and 1.4.6 but get the same results.

However, the really odd thing is that all my old reports work just fine.

Anyone got any ideas ??
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Arctic reports (reporting system - Windows)

Post by srod »

The ODBC builder in Pyrex reads all the data as strings and so will not be put off by any weird numeric format reported by the MySQL ODBC driver.

The nxReport core module will ask the driver for the underlying field format before retrieving individual fields. My guess is this is where the problem might be. Anyhow, a couple of things to check first.

Firstly, check the report fields in Pyrex (not the database fields). Make sure you haven't set some format which explains the weird behaviour you are seeing.

If all is ok, then write a small PB program to access the underlying MySQL database. Just a simple select query to pull out one of the fields causing problems. Use DatabaseColumnType() on the fields which are causing the problems and see what is reported? If it does not report #PB_Database_Float or #PB_Database_Double then we need to know exactly what is being reported?
I may look like a mule, but I'm not a complete ass.
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 639
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: Arctic reports (reporting system - Windows)

Post by captain_skank »

TA for the reply srod.

I'll knock something up and report back the exact details.
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 639
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: Arctic reports (reporting system - Windows)

Post by captain_skank »

ok here are the report fields and how they are reported :

Code: Select all

date_shipped : #PB_Database_String
part_id : #PB_Database_Long
part_number : #PB_Database_String
batch_number : #PB_Database_Long
qty_shipped : #PB_Database_Long
price : #PB_Database_String
currency : #PB_Database_String
exchange_rate : #PB_Database_String
sterling_sales_unit : #PB_Database_Double
batch_unit_cost : #PB_Database_Float
batch_currency : #PB_Database_String
batch_xrate : #PB_Database_Float
batch_sterling_unit : #PB_Database_Float
margin : #PB_Database_Double
total_sterling_sales : #PB_Database_Double
total_batch_sterling : #PB_Database_Float
It's 'total_batch_sterling' that's being truncated to a whole number which makes no sense to me.

FYI using getdatabasefloat the relevant field reports 75.863 and getdatabasestring reports the samebut the report shows 75.00
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Arctic reports (reporting system - Windows)

Post by srod »

Have you checked the report design? Have a look at the control which is displaying this field and check it's various formatting options. Make sure nothing is amiss there.

If the problem persists then create a really simple test report which uses the same database. Pull in just that single problematic field and display it in a suitable control. Does the problem still persist?

Next, use the DEBUG version of the nxReport dll and preview the test report directly through some PB code. You can then take a look at the debug output to see how nxReport is treating this problematic field.

If you can't get to the bottom of it then you may have to send me a copy of the test report and give me access to the database. I don't actually have an ODBC driver for MySQL installed at this time. It would make sense if I installed the same driver you are using if you could point me in the right direction.
I may look like a mule, but I'm not a complete ass.
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 639
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: Arctic reports (reporting system - Windows)

Post by captain_skank »

Sorry for the delay in getting back srod.

OK, heres what i've done so far.

Checked the report formatting - nothing amiss there.

Ran the report using the debug method - nothing untoward thrown up in the text file.

So I took the sql I use for the report and dumped it's output to a webgadget and it reports as it should with all the decimals etc.

I also reviewed the sql and all of the columns used are using TRUNCATE's to 3 decimal places - so I thought if i tried using FORMAT to return them as a string this might fix the issue.

Well it fixed the issue of displaying the decimal places in the report :D - however the report subtotals only work erraticaly - some groups are totaled correctly others it just doesn't bother :shock: .

I've even tried removing all formating from the sql and this still returns the value with no decimal places.

I'm at a loss to explain this, but will continue experimenting today.
Post Reply