cancel
Showing results for 
Search instead for 
Did you mean: 

Date & Time field formatting in Agentry / SSLM (initial value)

Former Member
0 Kudos

Hi,

Was wondering if someone could help me with the actual formatting of 'Date & Time' fields in Agentry. Purpose is to set an initial value for some of these field types in the mobile UI. While there are a couple of standard examples related to date and time calculations, setting a default value looks like an easy one, but seems to be a pain?

I used the initial value rule in combination with the 'transaction' properties (e.g. ActivityEmptyAdd). This location was fine since I was able to perform a test by using a constant date (this one got refelected on the device).

My (custom) initial value rule should default the minutes and seconds to '00' (by preference I would even like to get rid of the seconds entry from the ipad's 'scrollwheel' --> guess this is not possible). So basically, current date & time going from e.g. "09/12/2014 15:34:45" to "09/12/2014 15:00:00".

While I have no clue about the date returned (apparantly it's a date on which the USSR and China resume diplomatic relations), the formatting seems to be the desired one.

This again gives me a completely different result in the Sales Manager app on iOS:

Any ideas on how I can achieve this straigthforward requirement?

Thank you,

Sebastiaan.

Accepted Solutions (1)

Accepted Solutions (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

In terms of the display formatting, one option is to let the device handle it.  If you have an object of type date or date/time and display it on a detail screen the default behavior of the client is to use the regional settings on the device to determine how to display the value.   That way you can have users in different regions seeing the dates and times in their local formats without having to worry about writing a bunch of custom formatting rules for each region.

As far as setting an initial value, I am not clear on what you are trying to achieve?  What is the basis for the initial value?  Is it a constant date?

--Bill

Former Member
0 Kudos

Hi Bill,

Thanks for your answer. Maybe the term 'formatting' was wrongly chosen as I meant to manipulate the (default) current date and time stamp.

The requirement is pretty easy. I just need to take the current date and time setting and set the minutes and seconds to "00". I guess in my above example the '00' does not have a meaning in terms of minutes.

So basically if I can open up the detail screen and instead of defaulting current time & date (08/07/2014 16:43:45) to 08/07/2014 16:00:00 would be great!

Regards,

Sebastiaan.

jason_latko
Advisor
Advisor
0 Kudos

Sebastian,

Here is the rule to accomplish your requirement.  I tested this by placing two date/time fields on a detail screen.  The second date/time looks at the first via this update rule and removes the minutes and seconds.  You should modify this to look at the object or transaction property that you wish to convert, instead of SCREENFIELDVALUE of TestDate which is my first screen field.

DateTime fields in Agentry are stored as integer numbers and consist of the number of seconds past the Agentry epoch on Jan 1, 2001 (I believe that date is correct off the top of my head).  This rule then divides by 3600 (number of seconds in 1 hour) and takes the integer of that value to remove the remainder and get hours past the epoch.  Final step is to then multiply again by 3600 to put it back into seconds.

Jason Latko - Senior Product Developer at SAP

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thanks Jason,

Using your rule I was able to test setting the initial value of a transaction property that stripped out the minutes and seconds as Sebastian was attempting to do.  Formatting the date time as a string does not properly set the initial value as expected.

One quirky thing is that the Rule editor will complain that the PROD Function term cannot be evaluated in a String context.  You can either ignore it (which gave the desired result) or put another FROM_INTEGRAL_NUMBER before the PROD function so the rule evaluates correctly.

--Bill

Former Member
0 Kudos

Jason, Bill,

Many thanks to you both for the quick and thorough reply.

Added below to the Initial Value rule and added it to the 'Transaction Property Settings'.

Now when opening the screen, I get my dates 'rounded'.

You both deserve credits for this!

Thanks,

Sebastiaan.

Answers (1)

Answers (1)

0 Kudos

Hi All,

Can we display the weekday on the date field on ios platform with formatting rules?

Any idea if this is possible?

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Prashanthi,

Please open a new thread with your question so that you can mark it answered and others will be able to also benefit.

--Bill