Null values in memo

edited February 2019 in FastReport VCL 5
Hi,

I have a memoViews on Detail data, lets say memo1, meom2, memo3.
This memo fields may have null values.
What i need is whene a memo field hav a value, so not a null then its value must be value * 5;

"First of all, i am missing a good manual explaning Events, which one whene i can use. And about all options there are in delphi components"
I am using version 5 enterprise.

So i have tryed something like this
if ValidFloat(TfrxMemoView(Sender).Text) then
TfrxMemoView(Sender).Text := FloatToStr( StrToFloat(TfrxMemoView(Sender).Text) * 5);
Its jsut printing the values, withouth changing them.

Somehow i cannot test if a value null is, i have ConvertNulls false.
So please tell me in which event i have to do this and what will be the code to do this.
I am pointing all memoviews to the same function, thats why i am using TfrxMemoView(Sender).Text.
Tahnks

Comments

  • gpigpi
    edited 9:43PM
    [IIF(VarToStr(<YourDatasetName."YourFieldName">) <> '', <YourDatasetName."YourFieldName"> * 5, '')]
  • edited February 2019
    Is this checking for NULL values as wel? Becouse i am getting this error
    Could not convert variqant of type (array Variant) into type (OleStr)
    This is the code now

    TfrxMemoView(Sender).Text := [IIF(VarToStr(TfrxMemoView(Sender).Text) <> '', StrToFloat(TfrxMemoView(Sender).Text) * 5, '')];
    And can you specify on which event do i haver to do this? OnAfterData?
  • gpigpi
    edited February 2019
    TfrxMemoView(Sender).Text := '[IIF(VarToStr(<YourDatasetName."YourFieldName">) <> '''', StrToFloat(<YourDatasetName."YourFieldName">) * 5, '''')]';
    or just type in the memo
    [IIF(VarToStr(<YourDatasetName."YourFieldName">) <> '', StrToFloat(<YourDatasetName."YourFieldName">) * 5, '')]
  • edited 9:43PM
    if i do the first one then it is printing that text inside the memo.
    its printing this as a string [IIF(VarToStr(TfrxMemoView(Sender).Text) <> '''', StrToFloat(TfrxMemoView(Sender).Text) * 5, '''')]
  • gpigpi
    edited 9:43PM
    See a demo report template for FRDemo in the attach
    1.fr3 2.1K
  • edited 9:43PM
    This code is not checking for NULL valus i need to CHECK if a value is NULL or not then calculate;
  • gpigpi
    edited 9:43PM
    Set TfrxReport.EngineOptions.ConvertNulls to False and use [IIF(<Customers."Addr2"> <> null, <Customers."Cust No"> * 5, '')]
  • edited 9:43PM
    still getting error "could not convert variant of tyle (array Variant) into type (OleStr)"

    this is my code maybe i miss something
    margeInt is now 5.
    if (<Bestelling."margeInt"> > 0) then
    begin
    TfrxMemoView(Sender).Text := [IIF(TfrxMemoView(Sender).Text <> null, StrToFloat(TfrxMemoView(Sender).Text) * <Bestelling."margeInt">, '')];
    end;

    Still i dont know where is the right place, onbeforprint or onafterdata?
  • gpigpi
    edited 9:43PM
    1. Don't use TfrxMemoView(Sender).Text
    2. TfrxMemoView(Sender).Text is string, so it should be TfrxMemoView(Sender).Text := 'some text or expression';
    3. I'll see your ROfferte.fr3 from https://support.fast-report.com/tickets/535050 to understand what you need
  • edited 9:43PM
    You know that i cannot send you my all project, and i cannot create a project like this.
    Why you asking me, if you cant solve it then tell me that.
    I dont understand, is you the support of the company?
    I am asking you 5 times to explain what are the events, asking to point to a manual where i can read all options.
    Not getting any of my questions.
    Your unswers look like you didnot read my messages.
    i am very dissepointed!
  • gpigpi
    edited 9:43PM
    wrote:
    I am asking you 5 times to explain what are the events
    Use TfrxMemoView.OnAfterData event https://www.fast-report.com/public_download...rdata_event.htm

    I can't to help you without small demo project with error. Small project with one form, report and two datasets
  • You need to test if your filed is null, or use directly one InternalCalc field form one ClientDatasdet for example.


    Testing In Your Memo:

    [IIF(<YourDatasetName."YourFieldName">=null, 0, <YourDatasetName."YourFieldName"> * 5)]


    By Roberto Novakosky

Leave a Comment