Tonyperkis Absent Member.
Absent Member.
1360 views

Mass Update or Script to update activty table

I have added a new field in the activity table called full.name.  We are using ID in the recording operator field.  I have a trigger that will populate the full.name field going forward but I need something that will update all the old records where full.name is null.  Any suggestions?  Basically need to search the contact table for recording operator id, tanslate that into the full name stored in the contact table and populate full.name in the activity table. 

 

Please help with script or mass update.

 

Picture attached of what I'm trying to do.

 

0 Likes
5 Replies
kpa Absent Member.
Absent Member.

Re: Mass Update or Script to update activty table

Hi,

 

May be this can help you

 

var activity = new SCFile("activity");
// query Activity records with emty full.name field
var rc = activity.doSelect("null(full.name)");

while (rc == RC_SUCCESS)
{
	// Get Operator record using operator.id field in current Activity record
	var op = new SCFile("operator");
	var rc2 = op.doSelect("name = \"" + activity.operator_id + "\"");
	
	if (rc2 == RC_SUCCESS)
	{
		activity.full_name = op.full_name;
		activity.doUpdate();
	}
	
	rc = activity.getNext();
}

 

0 Likes
Highlighted
Tonyperkis Absent Member.
Absent Member.

Re: Mass Update or Script to update activty table

Thanks, I'm testing right now.  I will let you know how I make out.

0 Likes
Tonyperkis Absent Member.
Absent Member.

Re: Mass Update or Script to update activty table

I'm trying to test on just one record but running into issues.  Below is the java script I updated and I'm not 100% on how to run.  I tried adding the java script to the Display Application Screen Definition record for db.view

 

var activity = new SCFile("activity");

var rc = number;

while (rc == "IM924095")
{
    // Get Operator record using operator.id field in current Activity record
    var op = new SCFile("operator");
    var rc2 = op.doSelect("name = \"" + activity.operator_id + "\"");
    
    if (rc2 == RC_SUCCESS)
    {
        activity.full_name = op.full_name;
        activity.doUpdate();
    }
    
    rc = activity.getNext();
}

0 Likes
Contributor.. bzember Contributor..
Contributor..

Re: Mass Update or Script to update activty table

var op = new SCFile("operator");
if ( (op.doSelect('name="'+record.operator_id+'"')) == RC_SUCCESS )
{
record.full_name=op.full_name;
}

 in DS try this version

0 Likes
Contributor.. bzember Contributor..
Contributor..

Re: Mass Update or Script to update activty table

or when you will mass update activities use this statements in RAD expresion:

 

$L.qry="name=operator.id in $file";$L.void=rtecall("rinit", $L.rc, $operator, "operator");$L.void=rtecall("select", $L.rc, $operator, $L.qry);full.name in $file=full.name in $operator

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.