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

aymana98356406

19-01-2016

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!

Accepted Solutions (1)

Accepted Solutions (1)

Magus069

MVP

20-01-2016

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!