Highlighted
Respected Contributor.
Respected Contributor.
468 views

How to update action field as empty if there is no value in import file.

Jump to solution

Hi Experts,

My requirement is to insert a new line for each special character in action field. To achieve this, below is the JavaScript code written under Java Script tab of format controller.

Add: true

Update: true

if ( record.action[0] !=null)

{

                var n1=record.action[0].indexOf("$*@*$");

                if(n1!=-1)

                {

                                res = record.action[0].split("$*@*$");

                                record.action = res;

                }

}

javascript.JPG

The data of action field comes from ‘Note History’ column in Txt file. when Text Import runs, the system will take the data that is in that import and pass that data through the formatctrl record.  That javascript code will look at the 'action' field - the field that actually stores the Description data - and look at the first line of that Description.  It will break that data up into several lines, with a new line each time it hits the character string($*@*$).

Below is the txt file that I am using for importing data.

data.JPG

 For case ID 1234567890, content in Note history is getting updated to action filed in probsummary table. But for case ID 2135468790 , since there is no data in Note history , the data in action field should get updated as empty. But after importing it is showing the previous value of that case.

How to make this as empty?

Any suggestion is appreciated.

Thanks in Advance.

Jithisha

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: How to update action field as empty if there is no value in import file.

Jump to solution

I'm not real clear on what your overall goal with these requirements are - what you're actually trying to do with this one and the one you had before.  I don't know of a use case that would clear out the description field in an existing IM ticket, since, OOB, that field is a required field.  But, here's some information on how to do more data manipulation with Text Imports.  Do with it as you will.

By default, the system will ignore empty values in your import.

Think about the logic.  Let's say there's 200 fields in the probsummary table.  Then, let's say your import is going to update 15 of those fields.  If the tool set the value to NULL for any field where it did not get a value, it would have to set the remaining 185 fields to NULL, because your import didn't include those fields.  It would be a reasonable enhancement request (Microfocus, if you're listening) but it doesn't work by default.

That's not to say it can't be done.  

Just like you have code that can manipulate the data you send, you can create similar code to accomodate for null.

For example, in your import record, use the literal string "NULL" in the 'Notes History' columnin.

Then, in the calculation section of that formatctrl you could have code like:
add: not null(denull(action in $file)) and 1 in action in $file="NULL"
update: not null(denull(action in $file)) and 1 in action in $file="NULL"
calculation: action in $file={}

 

View solution in original post

2 Replies
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: How to update action field as empty if there is no value in import file.

Jump to solution

I'm not real clear on what your overall goal with these requirements are - what you're actually trying to do with this one and the one you had before.  I don't know of a use case that would clear out the description field in an existing IM ticket, since, OOB, that field is a required field.  But, here's some information on how to do more data manipulation with Text Imports.  Do with it as you will.

By default, the system will ignore empty values in your import.

Think about the logic.  Let's say there's 200 fields in the probsummary table.  Then, let's say your import is going to update 15 of those fields.  If the tool set the value to NULL for any field where it did not get a value, it would have to set the remaining 185 fields to NULL, because your import didn't include those fields.  It would be a reasonable enhancement request (Microfocus, if you're listening) but it doesn't work by default.

That's not to say it can't be done.  

Just like you have code that can manipulate the data you send, you can create similar code to accomodate for null.

For example, in your import record, use the literal string "NULL" in the 'Notes History' columnin.

Then, in the calculation section of that formatctrl you could have code like:
add: not null(denull(action in $file)) and 1 in action in $file="NULL"
update: not null(denull(action in $file)) and 1 in action in $file="NULL"
calculation: action in $file={}

 

View solution in original post

Highlighted
Respected Contributor.
Respected Contributor.

Re: How to update action field as empty if there is no value in import file.

Jump to solution

Thanks a lot .

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.