Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

What is there wrong in my greeting script?

Avatar

Level 4

Hi.

First of all, sorry make many question, but I can say I am learning very much with you!

What is there wrong in my greeting script?

When the hour number is, for example: 01,02,03,04,05... it returns always 0. But when hour number is 10, 11, 12, 13... it works very well.

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Rafael,

You should download this document, if you don't already have it:

http://partners.adobe.com/public/developer/en/xml/picture_clause_2.0.pdf

There are a few issues with the script.

  • Use H for lt 6 and HH for lt 12
  • Instead of > use gt. See script below
  • The first if statement should be 'or' instead of 'and'
  • FormCalc doesn't use 'this.rawValue', just $, which means the same thing.
  • You can drop the semi colon ; from the end of the lines in FormCalc
  • I would use an if/else statement.

This should get you closer:

if (Num2Time(time(), "H", "pt_BR") lt 6 or Num2Time(time(), "HH", "pt_BR") lt 12) then

     $ = "Good Morning"

elseif (Num2Time(time(), "HH", "pt_BR") ge 12 and Num2Time(time(), "HH", "pt_BR") lt 18) then

     $ = "Good Afternoon"

elseif (Num2Time(time(), "HH", "pt_BR") ge 18 and Num2Time(time(), "HH", "pt_BR") le 23) then

     $ = "Good Night"

endif


Hope that helps,

Niall

Assure Dynamics

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi Rafael,

You should download this document, if you don't already have it:

http://partners.adobe.com/public/developer/en/xml/picture_clause_2.0.pdf

There are a few issues with the script.

  • Use H for lt 6 and HH for lt 12
  • Instead of > use gt. See script below
  • The first if statement should be 'or' instead of 'and'
  • FormCalc doesn't use 'this.rawValue', just $, which means the same thing.
  • You can drop the semi colon ; from the end of the lines in FormCalc
  • I would use an if/else statement.

This should get you closer:

if (Num2Time(time(), "H", "pt_BR") lt 6 or Num2Time(time(), "HH", "pt_BR") lt 12) then

     $ = "Good Morning"

elseif (Num2Time(time(), "HH", "pt_BR") ge 12 and Num2Time(time(), "HH", "pt_BR") lt 18) then

     $ = "Good Afternoon"

elseif (Num2Time(time(), "HH", "pt_BR") ge 18 and Num2Time(time(), "HH", "pt_BR") le 23) then

     $ = "Good Night"

endif


Hope that helps,

Niall

Assure Dynamics

Avatar

Level 4

Hi Niall.

How are you?

It works very well! Sorry for my wrong developing. But I would like to say that with these wrongs and your help, I am learning very much. My english too LOL.

I will still buy that book "Creating Dynamic Forms with Adobe LiveCycle Designer". It must be great!

Thanks a lot for all your replies and solutions!

Have a nice day!