Skip to content

Michael

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 526 total)
  • Author
    Posts
  • in reply to: Drilldown #3552
    Michael
    Keymaster

    Hi John,

    I’m glad you got it and thank you to Ian for pointing you in the right direction.

    As for me, there have been a few bumps along the way, but we are still on course :).

    Ciao, Neil

    in reply to: Deleting a field from a table #3550
    Michael
    Keymaster

    Hi John,

    Can you send me a copy of the table (preferably without data in it)?

    Ciao, Neil

    in reply to: Drilldown #3548
    Michael
    Keymaster

    No, what I was suggesting was that you temporarily use a tablesearch() during development, just to establish the required colwidths, then pass those colwidths to drilldown().

    in reply to: Drilldown #3544
    Michael
    Keymaster

    You just pass .true for the showcolwidths parameter and .true for the allowcolwidthsdrag parameter.

    Ciao, Neil

    in reply to: Logarithms #3543
    Michael
    Keymaster

    John,

    Interesting work. I haven’t needed to use logarithms in any of my recent work, which is probably why I hadn’t chased this issue myself.

    Good job!

    Neil

    in reply to: Drilldown #3539
    Michael
    Keymaster

    Hi John,

    Question 1 is a bit complicated. It seems like you are looking for the maximum width of the grid content before it displays a horizontal scrollbar. This not always easy to sort out, and may depend on the font and font size in use. I tend to experiment myself until I find something I am happy with. The tablesearch actually contains a feature to let you display the column widths so you can figure it out interactively during the development phase, then you turn it off for production.

    As for question 2, you pass a setfilterhandler=myfilterhandler with an optional reference. The function receives either just the string of chars that have been entered or that plus the optional reference. The return value of the function is expected to be a valid whereclause entry for a report.

    function myfilter(string s)
      string where
    
      where = "BillingIssue LIKE '" + s + "' AND FeeAmount > 100"
    end function where

    Ciao, Neil

    in reply to: Minimum files to run smp app #3538
    Michael
    Keymaster

    The normal approach on a machine that doesn’t have SBNG installed is to copy the smpwin32.exe, the necessary DLLs, and the *.smp to a specific directory and then run it from there, typically using a link to the smpwin32.exe that includes the name of the *.smp as an argument to the smpwin32.exe and the path to that folder in the starting directory section of the link.

    in reply to: How Impor a CSV file into table? #3534
    Michael
    Keymaster

    The following code demonstrates an import merge from CSV to SBME. It uses the dbconverter.sml, the address.sbm from the Address Book tutorial, and an address.csv containing 4 rows of data. Please note that there is no provision currently for assigning a value to a record ID type of field. Either the import data needs that information in the appropriate field, or some other mechanism would be required to assign the required information after the import is completed. Also, this example does not demonstrate how to use a field list to restrict or reorder the data to match the output/input. It assumes that every field is present and in the correct order in the import file.

    Ciao, Neil

    
    function main()
      sbme1 sbmfile
      sbme1table table
      integer e, rowsout
      string s
    
      e = 0
      sbmfile =@ sbme1.new("address.sbm", "O", error=e)
      if sbmfile =@= .nul
        s = "Error " + .tostr(e, 10) + " opening database file address.sbm{d}{a}"
      else
        table =@ sbmfile.opentable("Address", error=e)
        if table =@= .nul
          s = "Error " + .tostr(e, 10) + " opening table Address{d}{a}"
        else
          rowsout = csvimportmerge(table, e)
          if e != 0
            s = "Error " + .tostr(e, 10) + " importing data{d}{a}"
          else
            s = "Successfully imported " + .tostr(rowsout, 10) + " records{d}{a}"
          end if
        end if
      end if
    end function s
    
    function csvimportmerge(sbme1table table, integer error)
      dbCSVImport imp
      dbSBMEExport exp
      integer e, rowsout
    
      imp =@ dbCSVImport.new(",", "{d}{a}", 1, 2)
      imp.opensource("address.csv", "ISO-8859-1")
      exp =@ dbSBMEExport.new("O", .true, 1000)
      exp.sbme =@ table.sbme
      exp.sbmetable =@ table
      exp.createtable(table)
      exp.datasourcename = "Address@address.sbm"
      exp.merge = .true
      e = 0
      rowsout = exp.export(imp, error=e)
      if e != 0
        error=e
      end if
    end function rowsout
    
    in reply to: Square Roots Mathlib.sma #3533
    Michael
    Keymaster

    Good, glad to hear it.

    in reply to: bitwise operators and sorts #3530
    Michael
    Keymaster

    1. Could you clarify to what “base” and “count” are supposed to refer?

    I find myself just using quicksortrit(myarray, 0, myarray.count()) but what else could you use and why?

    This is a recursive function, so it calls itself. You should always call it with the base of the array that you want sorted, and the total number of elements it should be sorting. QuickSort is a divide and conquer type of sort, so it breaks itself into chunks and calls itself to sort those chunks by passing in different values for base and count.

    Arrays in SIMPOL start at 1, not 0, so the count won’t work properly if the starting position is 0.

    Ciao, Neil

    in reply to: bitwise operators and sorts #3525
    Michael
    Keymaster

    Hi John,

    1. We don’t have the left shift, right shift, or complement operators. Having said that, they could easily be added as functions to mathlib.sml. Please note that a proper implementation might require additional parameters to decide whether they should optionally truncate at a certain bit size, since in SIMPOL they will never overflow.

    2. I would be very surprised if using a volatable for sorting is the fastest method. Generally I wouls stick with an implementation of quicksortrit(). It uses QuickSort for sections greater than 20 and then for those sections switches to insertion sort. It is probably the fastest sort I am aware of currently. Please be aware that all of the sorting algorithms that do not use sbme or ppcs tables, will not sort accented characters correctly. At some point I will see about exposing the comparison algorithm used by the database engines (this resides in sbsort32.dll) so that correct comparisons that support upper and lower case, accented characters, etc. can be done in SIMPOL code. Adding that level of support in pure SIMPOL would probably result in a significantly slower sort in general, even if the feature were not required.

    3. We are currently not ready/willing to expose the source code for those at this time.

    Ciao, Neil

    • This reply was modified 6 years, 9 months ago by Michael.
    in reply to: Strange Unwanted and Odd precision #3521
    Michael
    Keymaster

    One thing to try is to use .fix() when assigning currency values and to limit it to 2 (or even 4) decimal places. When dealing with currency another approach is to use an integer field and then always multiply the currency values by 100 when saving and divide by 100 when retrieving (plus using .fix() after dividing).

    in reply to: Logarithms #3518
    Michael
    Keymaster

    That is a possibility, but we would need to assess how that affects our integer and number types, since we don’t artificially limit precision in numbers and integers.

    Ciao, Neil

    in reply to: Strange Unwanted and Odd precision #3517
    Michael
    Keymaster

    Hi John,

    PPCS stores values in the same way that Superbase Classic does (100% compatibility), which means that NUM values are a C-language floating point double. Superbase NG stores number types as fractions, ensuring 100% precision. The problems arise when you try and use NUM fields as indexes, since the values get converted back and forth from exact precision to IEEE floating point.

    Essentially, using indexes on number fields is probably a mistake. We are planning a new multi-user database engine that will use TCP/IP and which will support all of the new Superbase NG datatypes, but until that is available, I would suggest avoiding the use of number data types for indexes (especially if you are using PPCS). There are workarounds, such as fixed length text fields, but they have their own issues.

    in reply to: Logarithms #3509
    Michael
    Keymaster

    Hi John,

    Not currently. Most decent log functions seem to actually just be stored look-up tables as far as I can remember, they don’t actually calculate anything, they just look up a value to save time.

    Ciao, Neil

Viewing 15 posts - 1 through 15 (of 526 total)