Highlighted
Valued Contributor.
Valued Contributor.
123 views

Insert field type time

Hello,

I have a script where I received parameters, and next I insert in a table.  I need insert one parameters into a field type 'date', but to be insert I obtain an error.

"Javascript previus to RAD"

var number=vars.$file.number;
var start=vars.$downtime_start;

addTime(number, start);
function addTime(number, start) {
    var file = new SCFile("test");
    file.id = system.functions.get_uid();
    file.number = number;
    file.downtime_start=start;
     var rc = file.doInsert();
    if (rc == RC_SUCCESS) {
         return true;
    } else {
        return false;
    }
}

The error appareance is: "ERROR Cannot store a string into an object of type time at char 1".

How could I insert this data correctly?

Thank you in advance!!

 

 

0 Likes
4 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Insert field type time

Hi VVim,

hope you are doing fine.

On what SM version are you trying to add the date field and where?

Carlos Villalobos R
Customer Support Engineer
If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation.
0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

Re: Insert field type time

Hello Carlos,

I have de 9.33.3000 SM version.

The date field I'm trying to complete from a script that i Call from a button, and I try to insert into a new table that I have created.

Thanks!!

 

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Insert field type time

Hi,

Is this possibly a typo here:

var start=vars.$downtime_start; 

?

Did you maybe mean:

var start=vars.$file.downtime_start; 

instead?

Best regards,

Armin

0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

Re: Insert field type time

Thanks for your answers.

Finally I retrieve the value of string type and I build it as date type to be able to insert it.

Regards!

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.