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 10:20PM
    [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 10:20PM
    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 10:20PM
    See a demo report template for FRDemo in the attach
  • edited 10:20PM
    This code is not checking for NULL valus i need to CHECK if a value is NULL or not then calculate;
  • gpigpi
    edited 10:20PM
    Set TfrxReport.EngineOptions.ConvertNulls to False and use [IIF(<Customers."Addr2"> <> null, <Customers."Cust No"> * 5, '')]
  • edited 10:20PM
    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 10:20PM
    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 10:20PM
    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 10:20PM
    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

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.