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

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

  • Verified Answer

    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={}