Please enable JavaScript to view this site.

 

Navigation: Tokens > Week Tokens

[sw] Start of Week Token

Scroll Prev Up Next More
the effect of an [sw:m] token

the effect of an [sw:m] token

Prefix any of the week tokens with the letter "s" (s for start), to have these tokens appear only on the first day of the week, as defined by the [sw] token GridOptions.

 

On other days the token converts to a blank. Note that this is not a zap token; blank means no text.

 

Some examples:

 

On Monday, August 1, [sw] = 30, and in English [sWeek] = Week.

Tuesday, August 2, [sw], [sWk], [sWeek] are all blank.

One way to use the [sw] token is in a daily diary where you only want the week number to appear at the beginning of a new week. For example the tokens [sWeek] [sw] would be blank on any day except at the beginning of the week, where they would combine to give, for example Week 34.

 

Appear on weekdays other than Mondays

 

You can specify that the [sw] token should appear on a different weekday than Monday by adding the :0X suffix to the [sw] token, where X can be any number from 1 (Monday) to 7 (Sunday), or by using the [sw] token GridOptions.

 

Special cases

 

In some cases, you might want to show the week number on the first day of some months as well as the first day of the week.

 

This is quite common in monthly grids, such as the one in the example above right, where the week number must appear on the first day of the month, as well as every Monday.

 

The above is done by adding a colon ":" and one of the followings characters at the end of the token.

 

Character

Example

Description

m

[sw:m]

Show the week number on the first day of the week and also on the first day of every month.

3

[sWeek:3]

Show the translation of the word "week" on the first day of the week and also on the first day of every 3 months.

6

[sWk:6]

Show the abbreviated form of the translation of the word "week" on the first day of the week and also on the first day of every 6 months.

y

[sw:y]

Show the week number on the first day of the week and also on the first day of the year.

 

Moving the position of the week number based on other events

 

You can use :~ suffixes to move the week number from its default position, usually Monday, to the first available place that has a certain number of days without any other event occurring (such as holidays or moon phases, for example).

 

The structure of these suffixes is one of the 3 following:

 

 :~DayCount_SetOfEvents

or

 :~DayCount-SetOfEvents

or

 :~DayCount/SetOfEvents

 

where

 

DayCount

This is a number from 1 to 7 indicating how many consecutive days, including the current one, must not contain any event from the SetOfEvents to display a week number.

 

If no number is specified, then the default value of 1 is assumed (ie. the week number will be displayed on the 1st day that does not contain any event from the SetOfEvents) and no underscore should be used.

_  -  /

These 3 variations only have an effect for weeks that are split across 2 months.

 

Using an underscore "_" means that the search for a period of DayCount free days starts no earlier than the first of the month.

 

This means that some week numbers may never be displayed if there is not enough room to display them at the end of the previous month.

 

in the token [sw:~2_67ae] using "_" does not display week number 40 at all, since the beginning of the month does not contain that week's Monday

in the token [sw:~2_67ae] using "_" does not display week number 40 at all, since the beginning of the month does not contain that week's Monday

Using a hyphen "-" means that the search for a period of DayCount free days starts at the beginning of the week, even if this means starting the search at the end of the previous month.

 

This guarantees that, unless the SetOfEvents is particularly extended, each week number will appear once (this option guarantees that a week number will never appear 2 times).

 

in the token [sw:~2-67ae] using "-" displays week number 40 at the beginning of the month despite that week's Monday not being in that month, ensuring that each week number appears once

in the token [sw:~2-67ae] using "-" displays week number 40 at the beginning of the month despite that week's Monday not being in that month, ensuring that each week number appears once

Using a front-slash "/" means that, in addition to searching for a period of DayCount free days in the first part of the week, at the end of a month, the search for a period of DayCount free days will start again at the beginning of the following month, the second part of the week.

 

This means that, if possible, the week numbers of all weeks that contain a change of month, will appear twice.

in the token [sw:~2/67ae] using "/" displays week number 31 twice as there is enough space

in the token [sw:~2/67ae] using "/" displays week number 31 twice as there is enough space

SetOfEvents

This is a series of letters corresponding to the various events that may cause a diary design to require the week number to be moved by one or more days. These letters are the same as those used in holidays response tokens, and are as follows:

 

a e i o u

Corresponds to the [fa]..[fu] holidays name token.

 

Optionally, you follow this digit with a number representing the specific index in the list of holidays, so that, for example, a5 would only be triggered if there was a holiday in the 5th set of the a-Holidays, corresponding to the token [fa:5].

â ê î ô û

Corresponds to the [â]..[û] holidays symbols token.

à è ì ò ù

Corresponds to the [fâ]..[fû] holidays abbreviation token.

á é í ó ú

Corresponds to the watermark token.

ä ë ï ö ü

Corresponds to the Saints tokens.

m

Corresponds to the Moon phase token [mp].

 

By default, if not otherwise specified, this is calculated using the first Moon Data Source. This can be changed by appending a number, for example m2, to evaluate the condition based on the second Moon data source of the current script.

s

Corresponds to the Season token [se].

 

By default, if not otherwise specified, this is calculated using the first Sun Data Source. This can be changed by appending a number, for example s2, to evaluate the condition based on the second Sun data source of the current script.

z

Corresponds to the Sun in Zodiac token [sz].

 

By default, if not otherwise specified, this is calculated using the first Sun Data Source. This can be changed by appending a number, for example z2, to evaluate the condition based on the second Sun data source of the current script.

0

 

followed by one of

 

1234567

Corresponds to weekdays (1=Monday ... 7=Sunday)

 

If you mix aeiou markers with 1234567 markers then you should prefix the 1234567 marker with a 0 (zero), or place the 1234567 marker before the aeiou marker, to avoid any ambiguity. For example, the marker combination ae7 could mean and the 7th set of e-Holidays, or could mean a holidays, e holidays and Sundays.

 

To avoid ambiguity, in such an example you would place the markers in the following order 7ae or use a 0 to have the set of markers ae07 to disambiguate the meaning of the 7.

 

Finally, note that Q++Studio lets you decide, for each DiaryGridLine, what the first day of the week is, using the property option week starts on.

 


Topic 087052, last updated on 03-Feb-2021