Highlighted
Respected Contributor.
Respected Contributor.
343 views

Adding numeric field in IM to calculate time spent

Jump to solution

Hi Experts,

My requirement is to add a mandatory numeric field in IM form in update phase. And purpose of this field to is to calculate time spent for an incident, and after updating that field has to be cleared. And for this i have done by having 2 text field, while updating the value in firlst field will be moved to second field, and in process i have given condition for clearing 1st field and for second updation the value of 1st field will be added with second field. the condition i have given in FC:

if (not (null(WPHourspent1 in $file))) then (WPHourspent1 in $file=WPHourspent1 in $file+WPHourspent in $file) else (WPHourspent1 in $file=WPHourspent in $file)

condition i have given for clearing is:

if (not  (null(WPHourspent in $L.file)) and (assignment in $L.file="Tier4 - Hardware and Industrial Controls" or assignment in $L.file="Tier4 – Data Pipeline" or assignment in $L.file="Tier4 – Writing Systems")) then (cleanup(WPHourspent in $L.file))

and in vadidation i have given like:

assignment in $file="Tier4 - Hardware and Industrial Controls" or assignment in $file="Tier4 – Data Pipeline" or assignment in $file="Tier4 – Writing Systems"---in update condition
not  (null(WPHourspent in $file))----default condition
Please Specify Hours Spent on the Incident.----error msg.

while saving it validating but getting another error msg which i have attachted in attachment.PFA, Calculation part is fine,but facing issue while validating.

Please help me out to resolve this issue. Thanks in advance.

Regards,

Abarna K

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Adding numeric field in IM to calculate time spent

Jump to solution

For this:

 (null($pmc.actions in $L.file)))

Can you change to:

 (null($pmc.actions)))

View solution in original post

0 Likes
12 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Adding numeric field in IM to calculate time spent

Jump to solution

Assuming this is all in FC, your clearing condition is using $L.file instead of $file, so it should be

if (not  (null(WPHourspent in $file)) and (assignment in $file="Tier4 - Hardware and Industrial Controls" or assignment in $file="Tier4 – Data Pipeline" or assignment in $file="Tier4 – Writing Systems")) then (cleanup(WPHourspent in $file))

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: Adding numeric field in IM to calculate time spent

Jump to solution

Thanks,

But that condition i have given in process, like while saving and save & exit, i have given that condition.

And when i remove validation condition, that error is not showing ("Invalid index: Element 0 has type STRING2 (se.call.process,run.post.exp)"). This is the error am getting along with validation error msg.

Please help me out in this.

Regards,

Abarna K

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Adding numeric field in IM to calculate time spent

Jump to solution

Can you show us the code you have in the Post Expressions of the Process record? Probably im.save

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: Adding numeric field in IM to calculate time spent

Jump to solution

Yes Sure,

Initially i have tried with this one, if (not  (null(WPHourspent in $L.file))) then WPHourspent in $L.file=NULL

then with this condition, if (not  (null(WPHourspent in $L.file))) then (cleanup(WPHourspent in $L.file))

and finally i have tried with this one,

if ((not  (null(WPHourspent in $L.file))) and (assignment in $L.file="Tier4 - Hardware and Industrial Controls" or assignment in $L.file="Tier4 – Data Pipeline" or assignment in $L.file="Tier4 – Writing Systems")) then (cleanup(WPHourspent in $L.file))

And i tried after removing condition from process, still this error "Invalid index: Element 0 has type STRING2 (se.call.process,run.post.exp)"" is showing, and i have removed validation conditiion from FC and gave the clearing condition in process, then this error is not showing, all calculation part it is working fine.

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Adding numeric field in IM to calculate time spent

Jump to solution

Is assignment or WPHourspent an array field?

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: Adding numeric field in IM to calculate time spent

Jump to solution

No, assignment is global list , and WPHourspent is not array field, just numeric field.

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Adding numeric field in IM to calculate time spent

Jump to solution

I'm fairly positive that "Invalid index: Element 0 has type STRING2" is referring to an array field. IS there any other code in the Process record that you haven't mentioned?

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: Adding numeric field in IM to calculate time spent

Jump to solution

Yes, but for some other requirement i have implemented this code in final expression in im.save,

if (notifiyGSSPartners in $L.file="true" and not  (null($pmc.actions in $L.file))) then (notifiyGSSPartners in $L.file="false")

in this $pmc.actions is array field, but this is local variable nowhere present in db. But for this requirement no array field i have created.

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Adding numeric field in IM to calculate time spent

Jump to solution

Just for a test, can you completely remove that line and then test it out to see if the error still exists?

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: Adding numeric field in IM to calculate time spent

Jump to solution

Yes, i have removed that line and tested, it is not showing. And that not(null($pmc.actions)) i have added along with if condition for hourspent, but that time it is showing error, this error is only for save and for save and exit it is working fine.

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Adding numeric field in IM to calculate time spent

Jump to solution

For this:

 (null($pmc.actions in $L.file)))

Can you change to:

 (null($pmc.actions)))

View solution in original post

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.