Skip to main content
floriang0001
April 28, 2021
Solved

How to convert a date to another format within a record?

  • April 28, 2021
  • 3 replies
  • 0 views

I am trying to change the date format of all values of a colum, and I do not understand the error message I am receiving:

a!gridColumn(
  label: "Deadline",
  sortField: 'recordType!{foo299792458}Step.fields.{timeGoal}timeGoal',
  value: a!richTextDisplayField(
    value: {
      a!richTextItem(
        text: {
          text(fv!row['recordType!{foo299792458}Step.fields.{timeGoal}timeGoal'],"yyyy/MM/dd")
        },
        color: if(fv!row['recordType!{foo299792458}Step.fields.{timeGoal}timeGoal']

The error reads:

Error Evaluating UI Expression

Expression evaluation error at function a!gridField [line 27]: A grid component [label=“null”] has an invalid value for “columns”. A grid column [label=“Time Goal”] has encountered an error. Expression evaluation error at function 'text' [line 36]: A null parameter has been passed as parameter 1.

Line 36 is the text-property where I attempt to convert the corresponding field of the record to the appropriate date format.

My question: What do I have to take care of to change the date-format for a given grid column?

Best answer by stefanhelzle0001

The error message is about one of your date values being NULL. The function text() is not null-save.You might want to add a null check.

3 replies

stefanhelzle0001
Brainy
April 28, 2021

The error message is about one of your date values being NULL. The function text() is not null-save.You might want to add a null check.

floriang0001
April 28, 2021

Good point, I fully forgot about my NULL values. So you are suggesting to do the if() around my conversion, correct?

stefanhelzle0001
Brainy
April 28, 2021

Yes. I typically create a set of "Display-Rules", simple expressions which I use to display a technical value to the user. These expressions must be implemented in a null-save way.