Post

2 followers Follow
0
Avatar

Get name of the weekday

I have a schedule app (WeekSchedule) with seven number fields:
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.

In another app - after a date is selected in a date field - I would like to get the number written in the referenced WeekSchedule field depending on which weekday it is. (ie. if the date is september 17, 2015 - the weekday is thursday and I need to get the number from Thursday-field in WeekSchedule).

Anders Bøgh Answered

Please sign in to leave a comment.

1 comment

0
Avatar

Hi Anders, you can try this in a calculation field in the other app:

var mon = @Sum of Monday; // from app WeekSchedule
var tue = @Sum of Tuesday;
var wed = @sum of Wednesday
and so on

var selDate =moment(@selection date field).isoWeekday();

selDate == 1 ? mon : selDate == 2 ?  tue : selDate ==  3 ? wed (.... and so on) : ""

var selDate gets the number of the weekday (1 = Mon, 7 = Sun). The last line read as: If selected date is Monday (= weekday numner 1) THAN (=?) take value from Monday-field ELSE IF (= : ) ... and so on ... last : "" (= ELSE show nothing (in case when no date is selected))

Rainer
rg@delos-consulting.com

Rainer Grabowski 0 votes
Comment actions Permalink