ObjectGears Help

           
Forum   ObjectGears (Version: 1.6.0.0)

Data transfer via URL

In the example hereinafter we will show transfer of data from one record to the form for creating a new record. The user will trigger this action by clicking on a button.

We will create a Button of the type Script in the class, from which we will take over the values, and Rule of the type Before new record detail display in the class, that will take over the values.

This script on the button will create URL containing variables and values from columns name, og_user a date. (Column of the type Long text is not suitable for transfer via URL because the maximal size of the URL is limited. Furthermore, there cannot be sign of the line end in the string - such a sign must be replaced.)

//creates URL containg variables and their values
if ( OGDataDetailForm.Save(false))
{
var clId = OGActualDataRowParentId;
var Id = OGActualDataRowId;

var dr = OG.DataRow.GetDataById( clId, Id);

var colName = OG.Column.GetByCode( clId, 'name');
var Name = dr.GetText( colName.Id);

var colSolver = OG.Column.GetByCode( clId, 'og_user');
var Solver = dr.GetPerson( colSolver.Id).Id;

var colDate = OG.Column.GetByCode( clId, 'date');
var Date = dr.GetDateTimeAsString( colDate.Id);

var newRecord = './DataDetail.aspx?Id=579-0' + '&varName='+Name+'&varSolver='+Solver+'&varDate='+Date;
OGForm.RedirectTo(newRecord);
}

We will insert function UrlValue with parameter according to the variable name in URL into corresponding column fields of the rule Before new record detail display in the class, that will receive the data. In our case it will be UrlValue('varName'), UrlValue('varSolver') and UrlValue('varDate').

This website is using cookies files to provide services and analyse visits. You agree with that by using this website.     Further information