Calculating Time Difference in InfoPath Form

This article describe a custom method for time difference based on a custom combo box used for hours and minutes input.

You can download the XSN file from https://1drv.ms/u/s!ApGubfWFh8Nuq5o3q77TRbTkVX634w

timesheet

This form is designated to calculate the time difference between end hour and minute and start hour and start minute.

The form contains a XML resource file used to populate the combo box for hours and minutes:

Structure:

<Hour>
    <HValue>9</HValue>
    <HDisplay>09</HDisplay>
    <HType>R</HType>
    <MValue>0</MValue>
    <MDisplay>00</MDisplay>
</Hour>

 

  • HValue – Integer from 0 to 23
  • HDisplay – Text, 00, 01 to 23
  • HType – R – Regular, ABH – After Business Hours, N – Night hours
  • MValue – Integer from 0 to 59
  • MDisplay – Text, 00, 01 to 59

Worked hours and minutes are calculated using xPath 1.0 (details in article IF-THEN-ELSE in xPath)

For H Diff (worked hours) formula is:

concat(substring(concat(substring(../my:EndH – ../my:StartH, 1, (../my:EndM – ../my:StartM >= 0) * string-length(../my:EndH – ../my:StartH)), substring(../my:EndH – ../my:StartH – 1, 1, (not(../my:EndM – ../my:StartM >= 0)) * string-length(../my:EndH – ../my:StartH – 1))), 1, (../my:EndH – ../my:StartH >= 0) * string-length(concat(substring(../my:EndH – ../my:StartH, 1, (../my:EndM – ../my:StartM >= 0) * string-length(../my:EndH – ../my:StartH)), substring(../my:EndH – ../my:StartH – 1, 1, (not(../my:EndM – ../my:StartM >= 0)) * string-length(../my:EndH – ../my:StartH – 1))))), substring(concat(substring(../my:EndH – ../my:StartH + 24, 1, (../my:EndM – ../my:StartM >= 0) * string-length(../my:EndH – ../my:StartH + 24)), substring(../my:EndH – ../my:StartH + 23, 1, (not(../my:EndM – ../my:StartM >= 0)) * string-length(../my:EndH – ../my:StartH + 23))), 1, (not(../my:EndH – ../my:StartH >= 0)) * string-length(concat(substring(../my:EndH – ../my:StartH + 24, 1, (../my:EndM – ../my:StartM >= 0) * string-length(../my:EndH – ../my:StartH + 24)), substring(../my:EndH – ../my:StartH + 23, 1, (not(../my:EndM – ../my:StartM >= 0)) * string-length(../my:EndH – ../my:StartH + 23)))))) – ../my:LunchBreak

  • LunchBreak – is 1 when is checked and 0 when is unchecked.

For number of minutes (M Diff) the formula is:

concat(substring(../my:EndM – ../my:StartM, 1, (../my:EndM – ../my:StartM >= 0) * string-length(../my:EndM – ../my:StartM)), substring(../my:EndM – ../my:StartM + 60, 1, (not(../my:EndM – ../my:StartM >= 0)) * string-length(../my:EndM – ../my:StartM + 60)))

Also, in the form is implemented a validation rules for cases when the hour is the same and start minutes are greater than end minutes.

ValidationRule

This rule is used also to deactivate submit button.

Future improvements: Add AM/PM format for time differences.

Hope it helps!

Fix Microsoft #SharePoint bug in Oslo Master page

This article describes a method for solving a problem with the interface in SharePoint sites with Oslo master page layout.

Symptoms

When you are selecting an Oslo master page layout for your site (Team Site) there is an issue in displaying large column lists.

See the following picture:

OsloSimtomps

You can observe left margin. If the list from the site contains more columns the left margin is bigger.

Investigation

I use classic Console/Debugger app from my browser and I identify that there is an issue related to the CSS formatting applied to:

div id=”titleAreaBox” and to div class=”content wrapper”.

Oslo contentwrapper

You can observe in Style section, value of the margins of content wrapper are in percent’s. These percent’s that are applies here are from the width of the page, not of the screen.

Solving steps

1. In SharePoint Designer 2013, open the site and navigate to Master Pages section.

2. Open in edit mode the file oslo.master. Find the expression div id=”titleAreaBox”, edit the line and add style=”margin-left:5px”

image

3. Find the expression div class=”contentwrapper”, edit the line and add style=”margin-left:20px;margin-top:20px;”

image

Save the page and go back to browser and refresh.

If you do not have access to SharePoint Designer, you can choose to corect the pages from a list using jQuery script added in page:

jquery-script-for-oslo-master

Hope it helps.

Imagine Cup 2017–News

Spre bucuria multor studenți, dar și a pasionaților de tehnologie, prestigioasa competiție Imagine Cup, organizată de Microsoft continuă și anul acesta (2016/2017) cu ediția a 15-a.

mainBlog

Așa cum ne-a obișnuit deja Microsoft aduce permanent schimbări nu numai în produsele sale ci și în competiția Imagine Cup. Anul acesta identificăm o schimbare de imagine și de integrare a competiției într-o platformă mai mare, Microsoft Imagine, care reunește mai multe instrumente destinate mediului Academic și educațional. Vechiul Dreamspark devine parte a platformei Imagine. De asemenea, identificăm o apropiere, nu integrat încă, cu platforma MVA.

Anul acesta, s-au anunțat până la data articolului, două competiții în Imagine Cup:

Hello Cloud

O competiție destinată pasionaților de tehnologiile cloud computing și care are la bază platforma Azure.

Este o competiție lunară cu premii de 1000 USD în fiecare lună. Anul trecut un student din Cluj-Napoca a câștigat premiul lunii martie.

Pașii pe care trebuie să-i parcurgeți pentru a participa:

P0. Căutați resursele de voință și încredere în voi.
P1. Vă creați un cont gratuit pe Microsoft Azure
P2. Finalizați una sau mai multe activități specifice
P3. Trimiteți rezultatul până în ultima zi de miercuri a fiecărei luni.

Reguli detaliate și sign up aici!

code.FTW!

Este o competiție adresată pasionaților de software design, care reunește toate secțiunile clasice de până acum: Inovație, Software Design și Gamming. Vestea cea mai bună este că premiul mare crește la această ediție la valoarea de 100.000 dolari.

code.FTW! este o competiție adresată echipelor de studenți. O echipă poate fi formată din maxim 3 membrii, iar proiectele trebuie să includă obligatoriu tehnologiile cloud Azure. Aplicațiile dezvoltate pot fi destinate dispozitivelor cu sistem de operare Windows, Android sau iOS.

În regulamentul oficial se recomandă ca fiecare echipă să nominalizeze un mentor, care poate fi cadru didactic la o universitate înrolată sau de la ONG-uri sau companii private.

Din surse neconfirmate încă, ediția de anul acesta va avea o finală locală găzduită cel mai probabil în Aprilie 2017 în București.

Anul trecut marele premiu la secțiunea Inovație a fost câștigat de o echipă de studenți de la Politehnica București. Detalii despre proiectul lor și implicațiile globale puteți consulta pe site-ul http://www.entymed.com/

Smiling members of the ENTy team strike a pose.

Echipa ENTy în finala de la Seattle, USA, 29 Iulie 2016.

Mult succes tuturor!

Blog la WordPress.com.

SUS ↑