Barcode Labels

Hi

Is there a way to print a specified number of the same barcode. I have created a column report which prints barcoded labels. The user must be able to specify how
many copies of the same label they require and Fastreport must print them as required. Is this possible with Fastreport.

Thanks
«1

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    Godfrey
    go to the files section of the fastreport group on Yahoo and download the flexlabel.zip demo it shows what you want.
    regards ;)
  • edited 2:29PM
    Gordk

    Thanks for the flexlabel example. I have two questions. If I have a label
    report linked to a query and the user selects one record to print a number of times, your example does not work. It has to have more than one record to print in the report. How do I get around this?

    Your code interests me. You have a procedure then before you have var or begin
    there is another procedure. Why do you do it this way?

  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    Hi
    by nesting the procedure inside i can disconnect it easily and i don't have to dig out the band name.
    I handle single selections differently when dblclick in grid
    modify frdbdataset range props to rbcurrent and i set open and close dataset to false,
    i use a modified version of the 2 reports
    added skip :=variable to dictionary and set mdband to virtual 1 record
    pass values into variables when report is loaded and set dataset to sum of skip and copies then in obp event of mdband add code
    mdband.visible := [Line#] > skip;
    this should give you some ideas.
    regards ;)
  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    hi godfrey
    ill upload another demo to fr yahoo group later tonight
    printlabelfromgrid.zip
    regards ;)
  • edited 2:29PM
    Gord

    Thanks very much for the example. ;) Sorry to hassel you like this. I would like to know if it is possible to adapt the first example to print either one record or many records. I would like my users to be able to select a start and end record from a stock database. I will then extract the records using a query. There will be the instance where the user will make the start and end record the same, selecting only one record. Is this possible?
    ;)
  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    Hi Godfrey
    If you look at the printfrom grid example you will notice there is no frdbdataset
    on the form and if you look at the reports you will notice that only 1 variable was added to the dictionary and the mdbands dataset was set to virtual 1 record, they are just renamed versions of the flexlabel reports, and what we are doing is hiding the memos rather than the band.
    ill upload another demo later to day to show how to do it.
    using the flexlabel demo and the reports from the printgrid
    you have to add an if statement in the obpevent of the mdband in the reports
    to see if intskip is >0 and code in the unit to switch datasources and set the onbeginband event of the report component to nil when printing single records
    and add a check box then mod code of buttonclick event after loading which report.
    regards;)

  • edited 2:29PM
    Hi Gord

    Got your latest file thanks. ;) One more question. With the text fields you put
    in "Visible := Showmemos". I have a barcode field, how do I control whether it is visible or not. When I use the skip labels, the barcode is still visible.
  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    hi godfrey
    reupload the file i replaced it this morning had uploaded wrong one
    you'll see some changes in the code and in the reports

    regards ;)
  • edited 2:29PM
    Gord

    Sorry to bug you like this. I am a newbie to fastreport. I downloaded the latest version of Flexlabelb. There is still two problems.
    1. I cannot preview the report at design time it gives an error "Invalid argument".
    2. When skipping labels. The barcode field still shows. The text fields are not visible. I noticed that in your very first example the barcode field did not show which was correct.

    Thanks
  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    Godfrey
    if you run single the code in the report obp must have bar1.visible := True/false in appropriate places,
    When in the ide if you put a report into design mode by dblclck rep component
    and it is dependant on outside delphi code it will not run properly.
    regards ;)
  • edited 2:29PM
    Gord

    I have tried various ways of trying to make to barcode invisible on
    skipped labels but I cannot get it right. Why do the memos not show on skipped labels but the barcode still shows. I cannot find the code which makes the memos invisible when printing only one record. Please help where should I put Bar1.Visible := False.

    Thanks
  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    Hi Godfrey
    I cannot find the code which makes the memos invisible when printing only one record. Please help where should I put Bar1.Visible := False.

    using the flexlabel2bdemo
    it goes in the onbeforeprint event of the band
    begin
    if srec = True then
    begin
    if [Line#] > [intskip] then
    begin
    memo1.visible := true;
    memo2.visible := true;
    memo3.visible := true;
    memo4.visible := true;
    memo5.visible := true;
    memo6.visible := true;
    memo7.visible := true;
    Line1.visible := true;
    //addbarcode here
    end
    else
    begin
    memo1.visible := false;
    memo2.visible := false;
    memo3.visible := false;
    memo4.visible := false;
    memo5.visible := false;
    memo6.visible := false;
    memo7.visible := false;
    Line1.visible := false;
    //and here
    end;
    end;

    end
    regards ;)


  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    Godfrey
    look at the band column report it already has the barcode on it
    i just didn't put it on the page column report.
    ;)
  • edited 2:29PM
    Gord

    Got it Thanks. ;) Just one more thing. When printing more than one label for multiple records the last label only prints once. Can you give me some pointers to sort this out.

  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    hi godfrey
    get flrxlabel2c.zip from the group
    i changed quite a few things
    regards ;)
  • edited 2:29PM
    How can I set the barcode type before I display or print the report.

    I am having difficulty accessing the objects on the report.

    Thanks
  • edited 2:29PM
    Gord

    On the lastest version flrxlabel2c.zip. I tested it with your data and it works fine. I then replaced your table comp with a simple Dbisam query comp. I then recompiled it and changed all the references from table1 to query1.

    Now when I print a report of all the labels, it gives me the correct number of labels, but they are all the same, the first record in the database. I noticed on the dbgrid when I tested with your data, the software scanned the table before the report was generated, after changing the dataset it did not do this. Is there a reference to the table in the report that I could have missed.

    Thanks
  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    godfrey no there isn't
    the movement is controled through the onuser function in delphi
    code....
    begin
    if not table1.Eof then table1.Next; // move next if not at eof
    val:= true; // return vakue to var moved in report
    end
    else
    val:= false;
    end;
    ......morecode ;)
    regards
  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    here is a sample of modifying a barcode.
    procedure TForm1.Button5Click(Sender: TObject);
    var
    B:tfrview;
    bcv: tfrBarCodeView;
    begin
    frreport4.Clear;
    frreport4.LoadFromFile(wpath+'bctest.frf');
    b:= frReport4.FindObject('Bar1');
    b.Prop:= '[Table1."Species No"]';
    // above way to access most props

    // below way to access params of barcode
    //*** add frbarcod to uses unit of interface section
    // if you take a look at the unit you will find all
    // available barcode types and the types of the other params
    bcv := TfrBarcodeView(frReport4.FindObject('Bar1'));

    if bcv <> nil then
    begin
    bcv.Param.cBarType := bcCode128A;
    bcv.Param.cRatio:= 2.0; // zoom
    end;

    frreport4.ShowReport;
    end;
    regards ;)
  • edited February 2004
    Hi Gord

    The moment I change the dataset from your table to a query. The onuser function does not seem to activate. Why.

    Thanks
  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    works fine for me
    add a query
    add fields with field editor
    change all refrences to table in implementation section to query1.
    and don't forget to change the memos in the report. from table1."fieldname" to
    query1.fieldname.
    regards ;)
  • edited 2:29PM
    Hi Gord

    I did exactly as you did except I am using a DBISAM Query. I tested the onuser function. None of it is being executed. Could it be something to do with Dbisam type of query?

    Thanks

  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    the onuser function is called each time the report encounters the user function
    ;)
    regards
  • edited 2:29PM
    Hi

    What is a user function? When using a DBISAM dataset I just cannot get the
    user function to activate. ;) Is there any way around this. I have tried everything I can using the limited knowledge of FR I have.

    Thanks
  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    Godfrey if you look at the report in design mode either 1 from flex label2c
    you will find a bit of code in one of the memos scripts, (the last one placed in the band)

    moved := ufmoverec([lprinted]);

    moved is a variable it will contain the result sent back from delphi of the value passed out through the userfunction ufmoverec(p1,p2,p3);
    when ever fast report finds an unknownname() folloed by brackets it triggers the on user function event of the report component itself.
    in this case we pass out the value of [lprinted] to delphi then in delphi

    procedure TForm1.frReport1UserFunction(const Name: String; p1, p2,
    p3: Variant; var Val: Variant);
    var
    s:integer;
    begin
    if AnsiCompareText(Name, 'ufmoverec') = 0 then
    begin
    s:= frparser.calc(p1); // gets valu of lprinted passed in p1
    if s = spinedit2.Value then // if vals match
    begin
    if not Query1.Eof then Query1.Next; //and not at end of file move next record
    val:= true;//return to fr's moved variable
    end
    else
    val:= false;// or return to fr's moved variable
    end;
    // could add more user functions here
    end;
    // when using Ansi compare text(NAME,'string') be careful it is case sensitive
    // the name used in 'string' must be exactly as it was in fr
    // ie 'Ufmoverec' and 'ufmoverec' would be two different functions
    and that might be your problem.
    regards ;)


  • edited 2:29PM
    Gord

    Thanks for your help. I got my problem. When I changed the dataset, I did not need all the memos on your report so I deleted the last three and without realizing I deleted the code on the last memo. ;)
  • gordkgordk St.Catherines On. Canada.
    edited 2:29PM
    That would explain why the user function was not triggering.
    regards ;)
  • edited 2:29PM
    After reading your post Gordk I found it to be very helpful and interesting. I have been struggling with a few aspects of producing my own Barcode Labels. I thought it would be much easier than it actually is to produce them, how wrong was I!!! So once again thanks for the helpful hints and tips you have left

    Many Thanks

    Dunk
  • edited 2:29PM
    zip demo it shows what you want.









    __________________
    WoW Gold| D3 Gold| RS Gold| Swtor Credits
  • edited 2:29PM
    Godfrey wrote: »
    Hi

    Is there a way to print a specified number of the same barcode. I have created a column report which prints barcoded labels. The user must be able to specify how
    many copies of the same label they require and Fastreport must print them as required. Is this possible with Fastreport.

    Thanks


    not quite clear about this but you may find the answer though google

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.