Menu

Simple print and data Export

Freen
2021-01-31
2021-02-21
  • Freen

    Freen - 2021-01-31

    Hi, I'm trying too many things, sorry

    I would like to make one very simple data collection database, which allows to print and export collected data, like a clipboard device.

    There are a few issues with the sample, I'm struggling with the code to create interaction.

    • When recording a new record, how to stop the user adding items into the DBGrid, until the record ID has been created?
    • Email tickbox, I think I got the code code right for the placement of the input field, but how to make the field visible, if a record exists?
    • How to print on record with the articles used as one A4 page?
    • Can one record with articles be exported into one Excel file?

    Thank you very much for any help.

     
    • neuts-jl

      neuts-jl - 2021-01-31

      I have no idea what you want to do

      When recording a new record, how to stop the user adding items into the DBGrid, until the record ID has been created?
      What ID of "Basic" or "Stock used"?
      "Stock used" is dependent on "Basic"?
      *
      What recording?

      mail tickbox, I think I got the code code right for the placement of the input field, but how to make the field visible, if a record exists?
      What recording?

      How to print on record with the articles used as one A4 page?
      with report

      Can one record with articles be exported into one Excel file?
      What recording?

      And why do you use comboboxes as single zones?

       

      Last edit: neuts-jl 2021-01-31
  • Freen

    Freen - 2021-02-02
    • ID of Basic is required first, before data for "Stock used" can be added.
    • Yes, "Stock used" is dependent on Basic. If I enter data into DBGrid, before Basic is saved, the data will be lost.
    • Recording = one (data)entry or one dataset.

    • Tickbox - ckRequireReport & edtMail - Data (from Basic.Email) present in field edtEmail is not shown, I don't know why.

    • Recording = one file/data entry item.

    • Comboboxes as single zones, I may have misunderstood your instructions? https://sourceforge.net/p/nsbase/forum/general/thread/0181bc879e/#031b/f1a3

     
  • neuts-jl

    neuts-jl - 2021-02-03

    What I understood

     
  • Freen

    Freen - 2021-02-04

    ckRequireReport... One line of code in a different location... argh
    Merci Beaucoup!

    Form Basic > new entry > data is lost in DBGrid, when form data is saved. How to prevent data entry in DBGrid, before a new Form entry is saved?

    Btn Save > how to code correctly to prevent error (...Operation not allowed...)?

    Report "stock for one" (your sample Factures.nsb helped!), but how to display/print the column headers in item RGridPanel? Is it only possible the way I have done? With additional rLabel outside of container RGridPanel?
    I noticed this in the sample Factures.nsb too, in edit mode of the Report, the column headers are shown, but when printing the report, only data is shown, but not the column headers. Is that intentional?

    txtRequireReport:Rtext how to print boolean value 'True' as "Yes" and 'False' as "No"?

    Sorry for all the questions ^^;

     
  • neuts-jl

    neuts-jl - 2021-02-04

    ckRequireReport is bound to a field in the database, so you need to put the function call, where the data changes
    Basic form> new entry> You must block the article as long as the record does not exist, so in insert mode
    btnSave, that saves what, if that's all, you have to put code knowing what is the main and / or the articles presented
    In the example invoice, the headers are not displayed even in edit mode, they are data fields.
    To put a header you have to put labels above / before the RGridPanel, like you did
    txtRequireReport: Rtext: you need to put code for each change, or do it in the request of your choice, I did it here in the view

     

    Last edit: neuts-jl 2021-02-04
    • Freen

      Freen - 2021-02-07

      Hi surfvite, I see the formula in filter BasicAndStockForOne, but the result for the formula is always 'No'? I can't see why this is happening.

        case Basic.RequireReport
          when true then 'Yes'
          else 'No'
        end RequireReport,
      

      On the reports, where or what formula would I need to apply to hide RLabel - labEmail - if there is no data in the field Email and RequireReport is 'No'?

       
  • neuts-jl

    neuts-jl - 2021-02-07

    The ZEOS library translates Boolean values into Y or N so the code must be

    case Basic.RequireReport
        when 'Y' then 'Yes'
        else 'No'
      end RequireReport,
    
     
    👍
    1

    Last edit: neuts-jl 2021-02-07
    • Freen

      Freen - 2021-02-07

      Got this function to work now, thank you :-)

      How to hide items on reports? Where or what formula would I need to apply to hide RLabel - labEmail - if there is no data in the field Email and RequireReport is 'No'?

      frmBasic, there is something confusing happening, when saving a new event. I can enter the data in all fields and select data with xcb Dropdown fields. When saving a new data entry, for example id '5', the form then displays the previous id '4', displaying part of the data from id 5 and blank fields on cbx fields. When clicking 'Refresh', the correct data is displayed.

       
  • neuts-jl

    neuts-jl - 2021-02-09

    1) element masking is not implemented
    2) I can't find the xcb component ??

     
    • Freen

      Freen - 2021-02-09

      2) Sorry, typing error, it's cbx -_-;

       
      • neuts-jl

        neuts-jl - 2021-02-10

        .

         
        👍
        1
  • Freen

    Freen - 2021-02-12

    Hello surfvite, I've made a DBGrid form and want to list events or stock used between two dates via interactive search function. How to make query for a date range?

    -

    DBGrid clColour highlight, this is difficult to explain. I want to highlight a cell without data (the user never stored data in that field), if I use

    [tbl.field]=" " clRed 0
    

    it does not work on empty cells if no data was stored. It will only work if you have stored [space] or 0 . I believe these empty cells show as [Null] in a sql editor.

     
  • neuts-jl

    neuts-jl - 2021-02-13

    1) Must compare your date with 2 parameters (date>: min and date <: max)
    2) This is a restriction of the current version which will be removed in the next version, the syntax is :
    if field="" then clRed clRed 0

     
    • Freen

      Freen - 2021-02-17

      BDGrid colour is working now, thank you.

      DBGrid, is it possible to use conditional formatting for one cell based on another cell? If field B is empty and field A = Yes then field B = clRed.

      if field_B="" and field_A='Y' then clRed clRed 0
      
       
      • neuts-jl

        neuts-jl - 2021-02-18

        Conditional formatting is not a programming language and does not support expressions
        you can compare one field with another or just a constant. according to the following operators "=, <,>, <>, Contains, NotContain"
        You can test a field(visible or invisible) to condition another field

        if field1="xxxxx" then clRed clRed 0 field2

         
        • Freen

          Freen - 2021-02-19

          I'm really struggling with this expression, but I'm sure the solution is to create another invisible field in the view?

          field Basic.RequireReport is boolean, yes/no (customer requires report or not)
          field Basic.ReportSent is a date field

          These are the 4 states:
          1 = RequireReport 'Y' and ReportSent "Null" = display 'Yes' in RRSDate
          2 = RequireReport 'N' and ReportSent "Null" = display 'No' in RRSDate
          3 = RequireReport 'Y' and ReportSent "anyDate" = display 'No' in RRSDate
          4 = RequireReport 'N' and ReportSent "anyDate" = display 'No' in RRSDate

          The formula below does not produce the desired result

            case Basic.RequireReport
              when 'Y' then 'Yes'
              when 'N' then 'No'
              else case Basic.ReportSent
                when NULL then 'Yes'
                else 'No'
              end
            end as RRSDate
          

          Conditional formatting:
          I want to use 'Yes' in field RRSDate for conditional formatting clRed on the date field ReportSent - this is working, thank you for the previous reply.

          if RRSDate="Yes" then clRed clRed 0 ReportSent
          
           
          • neuts-jl

            neuts-jl - 2021-02-21

            Sqlite is special for 'null' cases
            and you forgot a case in case
            RequireReport ="Null" and ReportSent "Null" = display '?' in RRSDate

            :::sql
            case
                when Basic.ReportSent is NULL then
                  case Basic.RequireReport
                    when 'Y' then 'Yes'
                    when 'N' then 'No'
                    else '?'
                  end
                else
                  'No'
             end as RRSDate
            
             
            👍
            1
  • Freen

    Freen - 2021-02-14

    Just checking on the expression - this seems to work, to display a different column name, is that correct? I'm not sure about the use of the equal sign = , but without it would not work at all.

      case
        when Basic.RequireReport = 'Y' then 'Yes'
        else 'No'
      end as Report_Required,
    

    I would like to have a date range dialog ((date>: min and date <: max)) for the export of data, is it possible to do this? Or would it be easier to create a form for this, with 2 date picker boxes?

    function Menu:btnExportActionOnClick()
    -- added dialog message, dialog window does not show file type *.csv for saving.
    nsbase.dialog.showMessage('info','User must type [filename].csv for file name')
     rc,filename=nsbase.dialog.fileOpen('Export','*.csv','','')
     if rc then
          rc=nsbase.fileSystem.export('BasicAndConsumablesAll',',',filename,'header')
       if rc then
         nsbase.dialog.showMessage('info','Export is ok')
       else
         nsbase.dialog.showMessage('error','Export is not ok')
       end
     end
    end
    
     

    Last edit: Freen 2021-02-14
    • neuts-jl

      neuts-jl - 2021-02-16

      1) Do not use an = sign

      :::sql
      case Basic.RequireReport
          when 'Y' then 'Yes'
          else 'No'
        end Report_Required,
      

      2) A dialog box containing datetimepicker will be displayed in a typed parameterized request
      example

      :::sql
      SELECT
        Basic.EventDate
      FROM
        Basic
      WHERE
        Basic.EventDate >:'date_mini:date'
      AND
        Basic.EventDate <:'date_maxi:date'       
      
       
      👍
      1

      Last edit: neuts-jl 2021-02-16

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.