Expand my Community achievements bar.

## Multiple conditions of an "If" statement

Former Community Member

Hello All,

I am trying to create a timesheet that fills in days of the week for me. Specifically, I have a TextBox named "Day"  that I input the day of the week, such as "Friday". I then have NumericBox1 that I want to automatically fill in the number "7", since Friday is the 7th day of our work week. Likewise:

Saturday = 1

Sunday = 2

Monday = 3

Tuesday = 4

Wednesday = 5

Thursday = 6

Friday = 7

I have written the follwing in FormCalc as a Calculation Event:

if

(form1.TimeSheet1.Table1.Row1.Day.rawValue=="Friday","7")

this statement works. HOWEVER, when I try to add additional staements to effect the other day's values, I receive a value of "1" every time.

Gene-O

2 Replies

Level 9

Hi Gene-O,

I am a bit confused regarding what you want to say here. For what condition you receive only the value as "1" and what more if statements you would like to add? Would you please elaborate a bit ?

Thanks,

Bibhu.

Former Community Member

Bibhu,

I wrote this in FormCalc as a Calculate Event in the "Number" field:

If (form1.TimeSheet1.Table1.Row1.Day.rawValue=="Friday","7")

It works just fine: when I type "Friday" into the "Day" TextBox, it returns a "7" into the Number field

BUT:

I also wrote these, but no matter what I type ("Friday" or "Wednesday", etc) in the "Day" TextBox, it returns a value of "1" into the Number field in all instances:

If (form1.TimeSheet1.Table1.Row1.Day.rawValue=="Friday","7");

If (form1.TimeSheet1.Table1.Row1.Day.rawValue=="Saturday","1");

If (form1.TimeSheet1.Table1.Row1.Day.rawValue=="Sunday","2");

If (form1.TimeSheet1.Table1.Row1.Day.rawValue=="Monday","3");

If (form1.TimeSheet1.Table1.Row1.Day.rawValue=="Tuesday","4");

If (form1.TimeSheet1.Table1.Row1.Day.rawValue=="Wednesday","5");

If (form1.TimeSheet1.Table1.Row1.Day.rawValue=="Thursday","6");

I need statements that if I type "Friday", it returns "7";

If I type "Saturday", it returns "1";

If I type "Sunday", it returns "2";

If I type "Monday", it returns "3";

If I type "Tuesday", it returns "4";

If I type "Wednesday", it returns "5";

If I type "Thursday", it returns "6"

All of these need to be in one script as a calculate event in the "Number" field.

Thanks!!!

Gene-O