Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Auto Increment Time in Repeating Table

Posted on 2013-06-07
12
Medium Priority
?
566 Views
Last Modified: 2013-06-11
I have a repeating table in my form.  When someone adds a new row I would like the form to automatically increment the "time" column field by 1/2 hour.  I have spent many hours on this, can anyone help?

Thank you.
0
Comment
Question by:cadlkid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
12 Comments
 
LVL 28

Expert Comment

by:clayfox
ID: 39230157
If you are using InfoPath 2010 or 2013, there is an addSeconds() function.  You can take the previous record or now() or whatever and add 1800 seconds to it.

Another method is to use substring functions to break out the hour and minutes and manually calculate but that is more complex to pull off.
0
 

Author Comment

by:cadlkid
ID: 39230177
Thank you for your quick response

I had just figured out how to add 1800 seconds to the "Time" field.  I then created a rule on the time field so that when a value changes it updates a variable to hold the new time that has been updated by 1/2 hour.  This works perfectly inside of Infopath but when I publish to my Sharepoint Form Library and open it inside of a browser, the time only gets update one time.  If I click the "close form" button and then immediatly cancel the dialog box, the repeating table then updates itself with all of correct times that have been updated by 1/2 hour.  Any ideas?
0
 
LVL 28

Expert Comment

by:clayfox
ID: 39230202
I would trigger the update in a different location probably.  Maybe a button or something else that is getting clicked each time if that is available.  Could even check and just make sure it is updated as a fail safe.

You can also specify in the browser properties how often it updates values. "postbacks"
0
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 

Author Comment

by:cadlkid
ID: 39230203
Here is screen shot inside of Infopath Application
inside-infopath.JPG
0
 

Author Comment

by:cadlkid
ID: 39230206
Inside of browser screen shot
inside-browser.jpg
0
 
LVL 28

Expert Comment

by:clayfox
ID: 39230212
I would probably have the rule and action on the insert, in the field default values.  I think that is the simplest.
0
 

Author Comment

by:cadlkid
ID: 39230233
Thanks Clay.  Unfortunately I don't understand exactly where you suggest me putting the rule.  Can you explain a little more in depth?  sorry.
0
 
LVL 28

Accepted Solution

by:
clayfox earned 2000 total points
ID: 39230269
I assume you have a default on the external field.

If you select the repeating table and add a new rule.
Do not put any conditions and it will fire on each insert.
First action is to update the external field with the time from the current record plus 1800 seconds.

Then (rightclick) the repeating table and go to properties.
Select the edit default values.

In there you can select the external field with the time and make it the default for the field to use on a new record.

If I remember right, i think you the order is run rules then default the new record.

You will have to play with it and I do not have the setup to test myself at the moment.
0
 

Author Comment

by:cadlkid
ID: 39237795
Hi Clay, me again.  What do you mean be "default on the external field"?  are you talking about a data source from a sharepoint library with the starting time that I want?
0
 
LVL 28

Expert Comment

by:clayfox
ID: 39237810
You said you had another "variable" field which was updated by time.

That is where you store the next time I assume.
0
 

Author Comment

by:cadlkid
ID: 39237897
OK, I finally got it working.  Clay, your advice was spot on.  Here are the steps I did following Clay's advice for anyone else who is interested in increasing the time for a repeating table at certain intervals (in my case every 1/2 hour)

1.  Start simple, add a 1 column repeating table to your form,
• name the field "Time"
• set it's datatype to "Time"
2.  add (2) text boxes to your form (but delete both right away so they are hidden)
• Name one of them "Add1800Seconds" - datatype "Whole Number"  default value of 1800
• Name the other one "TimeHolder" - datatype of "Time" - dafult value is the starting time you want (in my case it was 09:00:00 AM)

3.  Click on the repeating table to highlight it.  Add a rule to it....
• "Rule runs when field changes"
• Action "Set a field's value"
• Field "TimeHolder"
• Value "addseconds(TimeHolder, Add1800Seconds)

4.  Right click the repeating table, goto properties, edit default values
• Check "Time", set defeault value to "TimeHolder"
• Uncheck the "Refresh value when formula is recalculated" box
0
 

Author Closing Comment

by:cadlkid
ID: 39237900
super fast response time!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Before you can digitally sign infopath forms, you must have a digital certificate. Microsoft Certificate Services will need to be enabled on a Windows Server 2008 to facilitate the creation and verification of the digital certifciates on the web ser…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question