Level 1

0% to

Level 2

Tip /

to gain points, level up, and earn exciting badges like the new
Mission!

View all

SOLVED

## What is there wrong in my greeting script?

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

Level 10

Hi Rafael,

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

2 Replies

Level 10

Hi Rafael,

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

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!