cancel
Showing results for 
Search instead for 
Did you mean: 

Copying selected value out of a table and then validating the selected value SAP Personas 2

former_member105930
Active Participant
0 Kudos

hi experts,

I currently have some scripting that copies a date from a field in a table that is highlighted by the user and pastes them into custom text fields. This is the script:

What I then need to do, should the user then press the 'Change Record' button:

is to check to see if the selected startdate that has been pasted into the custom startdate field, is earlier than a specified date (which will be 01.04.203), but I am struggling to find out how to do this in Personas 2.

Can anyone help me with this?

thanks,

Ian

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I would create Javascript date objects by parsing the string into day/month/year components and passing the values to the Date object's constructor, and then you can just compare the dates. Something like this:


// First pick apart the strings into year/month/day and then feed them into

// something like this...

var date1 = new Date(2016, 3, 28); // Today - months are 0-11 var date2 = new Date(2016, 3, 21); // Last week if(date2 < date1) {     // do stuff }

Does that make sense?

Steve.

former_member105930
Active Participant
0 Kudos

Thanks as always Steve.

We did parse the string as suggested, then used this as a numerical value to work out if the date was earlier or greater than a specific date as follows:

It may be complicated but it does the job.

We are moving to Version 3 shortly so this will become somewhat easier I hope .

thanks again Steve,

Former Member
0 Kudos

Yes, this all gets easier in v3. You'll like it

Steve.

Answers (0)