0

Start with date in a multi line test field

Good evening and greetings to all.
I need that every time I enter a new text in a multi line text field, it automatically inserts the date before I start writing.
Can someone tell me how to do?
Thank you.

11 replies

null
    • Kruna
    • 1 yr ago
    • Reported - view

    Hi, you need to enter

    'name of your multi line text field'  := format(today(), "DD.MM.YYYY")

    in your table name in Trigger on new record.

    • j_espi
    • 1 yr ago
    • Reported - view

    Hi, Kruna, thanks

    I have done what you tell me but it doesn't work for me.
    I have done what you have told me and I have put the formula in the table trigger, but it deletes the text written by me.

    I have a table called 'Notes' and a text field called 'Comments'
     I want that if I write a comment today, today's date appears and tomorrow when
     I write another comment I insert tomorrow's date keeping the previous comment and 
    yesterday's date and so on.
    All this in the same registry.
    I do not know what I'm doing wrong.
    I'm new to Ninox, excuse me

    regards

      • Kruna
      • 1 yr ago
      • Reported - view

      J. Espí no problem. I am not that new, but I also dont know much. :-)

      Well, I didnt know waht you wanted to achieve actaually.

      Can you pls send me a test db? I could have a better look at it

    • Fred
    • 1 yr ago
    • Reported - view

    You can try something like:

    In the Trigger on new record:

    Comments := today() + "
    "
    

    For me if I just do:

    Comments := today()
    

    It puts in the milliseconds so I added the carriage return at the end and it treats it as text. It might work for you with the carriage return if you use the Cloud version.

    I don't know if you want a date in Comments whenever you create a record. You can decide on that.

    Then in the Trigger after update you can try:

    if contains(Comments, text(today())) then
        null
    else
        Comments := Comments + "
    " + today()
    end
    

    I start by looking to see if the current date has already been entered and if it has then I won't do anything to the Comments field. If I can't find today's date then I will add today's date. With out the check then anytime you make an update to the record it will log today's date.

    Another way is to create a Comments child table and create a new record for each new day. So you can have as many or as few comments per Note record as you want.

    • j_espi
    • 1 yr ago
    • Reported - view
    Hi Kruna and Fred,
    
    Thank you very much for your interest.
    
    I've tried what you suggest, Fred, and I can't get it to work.
    
    I am sending you a screenshot of what I really want to do. I think I have not been able
     to explain myself clearly, please excuse me.
    
    It is a field of a record that I would update when needed, adding comments on different
     dates.
    
    Thank you very much again
    
    
    
      • Ninox partner
      • RoSoft_Steven.1
      • 1 yr ago
      • Reported - view

      J. Espí 

      My small contribution: You can use a second text field to fill your multiline textfield:

      Using this allows you to add comments through the textfield. Sample database enclosed:

      Code in the trigger after update of the Text field:

      let t := Text;
      let d := text(today());
      let s := "
      ";
      'Text (multiline)' := if 'Text (multiline)' then
              'Text (multiline)' + s + d + " :" + t
          else
              d + " :" + t
          end;
      Text := null
      
    • j_espi
    • 1 yr ago
    • Reported - view
    Hello everyone
    
    Thank you very much Kruna, Fred and RoSoft_Steven
    
    I'm trying to accommodate both Fred's solution of creating a new table for
    comments and Steven's Solution.
    
    When I've tried enough I'll do it one of two ways.
    
    If I find any other way I will let you know.
    
    Thank you very much again.
    
    jel
    
      • Fred
      • 1 yr ago
      • Reported - view

      J. Espí Next time please don’t put your non-code into the code blocks (the grey box). Just type your words in the white space. Put only code examples in the grey boxes. It is hard to read your response on smaller screens. :)

      • j_espi
      • 1 yr ago
      • Reported - view

      Fred Please excuse me 
      It happens because I copy from Google translator and when pasting it does it directly in the grey part

      Excuse me

      :/

    • j_espi
    • 1 yr ago
    • Reported - view
    @fred
    Thank you very much for your indication for interventions in the forum.
    I didn't know it was done like that.
    
    I will do it that way in the future.
    Sorry for the inconveniences.
    Best regards
    
    (I hope to do well this time)
    
    :)
    
    • j_espi
    • 1 yr ago
    • Reported - view

    Oh..oh..

Content aside

  • Status Answered
  • 1 yr agoLast active
  • 11Replies
  • 100Views
  • 4 Following