cancel
Showing results for 
Search instead for 
Did you mean: 

Creation of Buttons in Agentry

Former Member
0 Kudos


Hi,

I need to create few buttons in form of two rows. In the first row there will be 3 buttons which define activity type - Work, Lunch,  Drive. In the second row there will be 3 buttons - Start, Pause and Hold.

For Eg, if the user clicks on Work button in first row and then on start button in second row then the timer should start. If user now clicks on Hold the this timer should be paused and if he clicks on Stop button then the timer should be stopped. Finally I need to calculate the total time duration taken for this particular activity and send it to the backend. I need to perform these actions in Agentry. Similarly the user may click on other two buttons like Lunch and Drive and click on any of the three buttons in second row.

Please let me know what type of buttons to be used while creation and how to configure the properties for these buttons so that I can have the timer being worked according to the actions of the user.

I would be using Agentry for designing these buttons and Java for sending the data to backend.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Madhuri,

You can of course use screen buttons to control your actions.  These would display on the side or bottom of the screen.  Otherwise, you can use button fields on a detail screen which you can then position anywhere you desire.

Adding a button field is simply a matter of adding a field to the screen and setting the Edit Type to button.  After changing the edit type and clicking save you will see a Button tab on the properties pane (see image below).

You can change the button appearance based on your need.  Based on your description you will probably want Push Buttons where you then assign actions to run when the button is pressed.

You can define properties on your main object to hold the type of button pressed and also the start  time.  For each of the buttons define a transaction to edit the property on the main object setting the type based on which of the three were pressed.

When the start is pressed, use an edit transaction to set the start time to the current time.

Then when either the hold or stop button is pressed you can define your transaction to genearte the time entry and use before/after data entry rules on the transaction properties to calculate the elapsed time or simply store the start / stop times along with the type and perform the calculation as part of your update step to the backend.

Hopefully this will help you get started.

--Bill

Former Member
0 Kudos

Thanks for the solution Bill. It worked.

Also I have an other query.

If the user clicks on Start and then on Hold button then the duration is being calculated between Start and Hold time and set into a property. Now if the user clicks on Start and Hold again then the duration is being overrideen with the new value and the total duration is now not the sum of all the Hold durations.

Can you suggest me if there is a way where we can have the property holding the cumulative values of all these durations and calculate the total duration finally.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Madhuri,

The challenge will determining when do you reset the total time elapsed?

I would probably just use a third property on the main object for the total time elapsed which based on my business logic I would reset to zero the first time I started the process / work.  Then also set my start time and end times which can then calculated (as you are doing now) to update both the new elapsed time interval and also add that new elapsed time interval to the total time.

--Bill

Former Member
0 Kudos

Im using a transaction through which the difference between Start and Hold times is being calculated and set to a property. Now the next time when the transaction is being started the property holding this difference is being initialised to 0. Hence my old difference is getting erased. So now I am unable to calculate the total time.

Can there be a way where I can store this value and keep adding whenever the transaction gets started.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

In your transaction check the settings for the initial value for the property.  It may be set to a constant where what you will want is to set the initial value to the current property value rather than initializing to zero each time the transaction runs.

--Bill

Former Member
0 Kudos

Currently I have used the following approach:

When the user clicks on Start a transaction gets started. This transaction has property - StartTime (its initial value is the current date and time).

Now when the user clicks on Hold an other transaction gets started. This transaction has properties - HoldTime(its initial value is the current date and time) and HoldTimeDuration(its initial value is the rule-after data entry which calulates the difference between StartTime and HoldTime).

Now when the user is clicking Start for second time StartTime property is getting updated to current date and time. And when he clicks on HoldTime property is getting updated to current date and time and HoldTimeDuration property is getting updated with the difference and the previous values is being overridden.

As per my requirement, whenever the user clicks Stop button I have to add all the Hold durations and then send to backend once the transmit button is clicked.

So I have to either add the new value to previous value or store the new values somewhere.

Can you suggest me a way where I will be able to perform this.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Madhuri,

I would recommend doing just what you mention, using another property and adding the new value to the previous total.  The challenge is determining when to reset the overall total.

Is there a way to determine the first time the start button is pressed?  Can you use another property on your work to indicate if it is the first time it is being started?

Also, you don't mention but when then press hold, are they then starting work on a different activity in between when they will start again on the original work?  I ask because the answer will determine where the total time needs to be stored (main object or individual work/activity object).

--Bill

Former Member
0 Kudos

I used two properties in work object. One is Activity. This will hold the values as Work/Drive/Lunch on click of any of them. Other property is ActivityType which hold values as WorkStart/LunchStart/LunchHold and so on.

So I think a way to determine the first time the start button is pressed could be when ActivityType is blank and gets changed to WorkStart/LunchStart/DriveStart on click of Start.

Yes, I can use another property on work to indicate if it is the first time it is being started.

Yes, when the Hold button is pressed they can start work on a different activity.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Based on this I would suggest another property on the work object for the total time.

I would create a subaction with an execution rule to only run when you detect it is the first time you are starting which will call a transaction to zero out the total time (new property on the work object) and then run your normal start process.

Then when you hold you can update the total time to include the new time interval + current value.

When you complete the work just send the total time value to the backend in an appropriate transaction.

--Bill

Former Member
0 Kudos

Hi Bill,

Thanks a ton for the solution. It worked.

Can you suggest me how to reset the values. I also have a collection which should be reset along with other values.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Madhuri,

I think I saw you post the reset question seperately (and it was already answered).  If you still need assistance please open a new thread.

--Bill

Former Member
0 Kudos

Yes Bill. My question has been answered. Thanks for the reply.

Answers (0)