I am working out some log where employees can request vacation, sick time, etj. One validation rule requires that you must always request time off in 4 hour intervals. This is easy enough to do – use a modulo function. Modulo function tells you the remainder in division. If there is no remainder, modulo is zero, ndryshe, it’s whatever is left. Për shembull, 8 mod 4 = 0 (8 / 4 = 2 with no fraction). On the other hand, 8 mod 5 is 3.
I needed to do this once with SPD 2007 once upon a time and I actually ended up using an InfoPath form to solve, so it was handled on the front end at the time. In the current case, there may be an InfoPath form in the picture, but that’s not clear yet. Kështu, I was working out a technique to ensure that time requests are always in 4 hour increments. I was going to do the math, save it in a string and then do some substring stuff.
I pull up SPD 2010 and to my surprise (and a little embarrassment) there is a modulo function already:
I am once again pleasantly surprised that something I needed is already there out of the box. It does seem like a weird function for Microsoft to include in the mix. It has a sort of “this is easy, so let’s throw it in” feel to it. I sympathize with that, as I do it myself all the time. This CodePlex project has a bunch of little functions that result from the ItsEasy principle. Në të njëjtën kohë, Microsoft continues to support evidence the “95% of the way” effect with the product. They implement the Mod function, but not the round function, for instance.
</fund>
Atëherë ejani pas meje në Twitter në http://www.twitter.com/pagalvin
Pingback: Tweets that mention SharePoint Designer 2010 MOD function « Paul Galvin's SharePoint Space -- Topsy.com