How can i use ,' ReportObject.AddVariable(string Category,string Name,Object Value)'

hi all,

I want to add my own [VARIABLE] to Fast-Report Designer at Run-Time in [Variables] Section of IDE so
as you know we have a function called [AddVariable] with Following Syntax:

ReportObject.AddVariable(string Category,string Name,Object Value);

i want to declare a string Variable as follow:

ReportObject.AddVariable("My String Variables","LogedInUserName","John Vilson");

so far anything is ok and my Report - Designer displayed successfully BUT when i drag and drop the above variable from IDE to the
Designer and then press the Preveiw Button, Nothing appears !!! BUT if i return NUMERIC value instead of STRING value in above example such as :

ReportObject.AddVariable("My String Variables","GetLogedInUserNAme",12345678);

it appears in preview mode successfully !!! What am i doing wrong?

Thanks in advance.
Kind Regards.

Comments

  • dsydsy
    edited 1:27AM
    ZarrinPour wrote: »
    hi all,

    I want to add my own [VARIABLE] to Fast-Report Designer at Run-Time in [Variables] Section of IDE so
    as you know we have a function called [AddVariable] with Following Syntax:

    ReportObject.AddVariable(string Category,string Name,Object Value);

    i want to declare a string Variable as follow:

    ReportObject.AddVariable("My String Variables","LogedInUserName","John Vilson");

    so far anything is ok and my Report - Designer displayed successfully BUT when i drag and drop the above variable from IDE to the
    Designer and then press the Preveiw Button, Nothing appears !!! BUT if i return NUMERIC value instead of STRING value in above example such as :

    ReportObject.AddVariable("My String Variables","GetLogedInUserNAme",12345678);

    it appears in preview mode successfully !!! What am i doing wrong?

    Thanks in advance.
    Kind Regards.


    Test with

    ReportObject.AddVariable("My String Variables","LogedInUserName","John Vilson"+chr(13));

    in vb6 is ok

    Bruno
  • edited 1:27AM
    dsy wrote: »
    dsy wrote: »
    hi all,

    I want to add my own [VARIABLE] to Fast-Report Designer at Run-Time in [Variables] Section of IDE so
    as you know we have a function called [AddVariable] with Following Syntax:

    ReportObject.AddVariable(string Category,string Name,Object Value);

    i want to declare a string Variable as follow:

    ReportObject.AddVariable("My String Variables","LogedInUserName","John Vilson");

    so far anything is ok and my Report - Designer displayed successfully BUT when i drag and drop the above variable from IDE to the
    Designer and then press the Preveiw Button, Nothing appears !!! BUT if i return NUMERIC value instead of STRING value in above example such as :

    ReportObject.AddVariable("My String Variables","GetLogedInUserNAme",12345678);

    it appears in preview mode successfully !!! What am i doing wrong?

    Thanks in advance.
    Kind Regards.


    Test with

    ReportObject.AddVariable("My String Variables","LogedInUserName","John Vilson"+chr(13));

    in vb6 is ok

    Bruno

    Hi guys,

    Anyone know how to do this in C#? Below is what I did:

    1) Report.AddVariable("My String Variables","LogedInUserName",12345); <
    works
    2) Report.AddVariable("My String Variables","LogedInUserName","John"); <
    crash

    I have tried

    3) Report.AddVariable("My String Variables","LogedInUserName","John" + chr(13)); <
    doesn't work as well

    Is there any ways to solve this in C#? Many thanks.
  • gordkgordk St.Catherines On. Canada.
    edited 1:27AM
    first i don't work with studio version so this may not apply.
    a categorized variable is treated as an expression for further calculation, so the value passed can be a valid numeric, an expression, to pass a string value you must use extra ' delimiters.
    ie. if the value ends up as John it will be treated as an expression and the expression parser will try to calc a value for it, since it dosen't recognize this expression it triggers the ogv event and if no handler is written for the event it will return an error.
    if the value in the variable ends up as 'John' , (note the value contains delimiters)it will be treated as a string.
  • edited 1:27AM
    Hi

    Plase send an email to me! mahbodm@gmail.com

    montazeram
    fdavood

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.