Expand my Community achievements bar.

SOLVED

How i do write more than specific IF statement at the same time!!

Avatar

Level 2

I am trying to use an IF / ELES formula in JavaScript to autopopulate a text field in a table, but I keep  getting a syntax error.

Could someone please help?

and I want to write a specific text on cells from an table, but before I want to check if this cell was empty or not, if empty (this cell1.rawValue = "text") eles must go to cell 2 and testing eles to the next. And so on.

Tabel1

1yes
2no

tabel2| 

cell1      "text"
cell2               
cell3
cell4

something close to this may can help you understand me more: (this is not really code)

if tabel1.rawValue = 1

     and if tabel2.cell1.rawValue == null then

              tabel2.cell1.rawValue = "text"

            else

                    if tabel2.cell2.rawValue == null then

                       tabel2.cell2.rawValue = "text"

                    eles

                              if tabel2.cell3.rawValue == null then

                                 tabel2.cell3.rawValue = "text"

                             eles

                                       if tabel2.cell4.rawValue = null then

                                          tabel2.cell4.rawValue = "text"

eles

{

xfa.host.messageBox("There is no space in the table!!!");

}

thnak you! i wish you can help me!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi there,

before understanding syntax in JavaScript, there is basics you should understand with the operators

JavaScript Operators :

JavaScript Syntax :

'then' is omitted in JavaScript and { } is used instead

don't forget to put the end of line (semicolon) on each line (excluding statements (if, switch, else, else if, etc...))

To help you understand how to fix your JavaScript syntax, you can use syntax validator such as, Esprima: Syntax Validator

Any other information on JavaScript syntax can be found on google, W3Schools is a good start

Hope this will help!

View solution in original post

3 Replies

Avatar

Level 2

PLEASE!!!! is there anyone can help me to fix it?...
why there  is no answer??????

Avatar

Correct answer by
Level 10

Hi there,

before understanding syntax in JavaScript, there is basics you should understand with the operators

JavaScript Operators :

JavaScript Syntax :

'then' is omitted in JavaScript and { } is used instead

don't forget to put the end of line (semicolon) on each line (excluding statements (if, switch, else, else if, etc...))

To help you understand how to fix your JavaScript syntax, you can use syntax validator such as, Esprima: Syntax Validator

Any other information on JavaScript syntax can be found on google, W3Schools is a good start

Hope this will help!

Avatar

Level 2

Thank you a lot Magus069you are an super its working