I have a field “SelectedMonths” it is a Checkbox and it has all the months in a year. In the Form for display purpose i am displaying the Months but in the document i am storing the Month Numbers. Ex: January | 1, February | 2
In the View the “Selectedmonths” column displays 1,2,4 if those four months are selected but i wanted the view to display January,February,April
I was just wondering if anybody can give me an idea regarding the formula…
Thanks,
Durga
Subject: Formula for Checkbox Field in View
modify this:
dateValue := @Month(@Created);
month := @If(
dateValue = 1 ; "January" ;
dateValue = 2 ; "February" ;
dateValue = 3 ; "March" ;
dateValue = 4 ; "April" ;
dateValue = 5 ; "May" ;
dateValue = 6 ; "June" ;
dateValue = 7 ; "July" ;
dateValue = 8 ; "August" ;
dateValue = 9 ; "September" ;
dateValue = 10 ; "October" ;
dateValue = 11 ; "November" ;
"December");
month
Subject: Formula for Checkbox Field in View
you can try the formula below, there may be simpler one but this is what I can get so far:
temp := “”;
@For(n := 1; n<=@Elements(SelectedMonths); n := n + 1;
temp := @Trim (temp + " " + @Word (“January February March April May June July August September October November December”; " "; SelectedMonths[n])));
temp
HTH
Subject: RE: Formula for Checkbox Field in View
@Replace(SelectedMonths; “1”:“2”:“3”:“4”:“5”:“6”:“7”:“8”:“9”:“10”:“11”:“12”; “January”:“Feb…ber”:“December”)
Do not use @If as Michael suggests; that’s very inefficient.
Subject: Formula for Checkbox Field in View
I’ll throw in an additional way to do it- @select(@texttonumber(MonthNumber);“January”:“February”:“March”:“April”:“May”:“June”:“July”:“August”:“Septmeber”:“October”:“November”:“December”)
Subject: * yeah, if it weren’t multivalued, and if you used ; rather than :
Subject: Thanks for all your time and responses… It worked
Thanks for all your time and responses… It worked.Andre is correct, @Replace is much faster.