Showing posts with label Records. Show all posts
Showing posts with label Records. Show all posts

Wednesday, April 1, 2015

Working with Grids

Navigating with Peoplecode

Example


Local Rowset &rs = GetLevel0()(1).GetRowset(Scroll.NAMES);

For &i = 1 To &rs.ActiveRowCount
   If &rs(&i).NAMES.NAME_TYPE.Value = "PRI" Then
      Messagebox(0,"",0,0,"This is the Primary email name ",&rs(&i).NAMES.NAME.Value);
   End-If;
End-For;

Display the code value of a translate.

I had a case where I wanted to display the actual translate code value on a grid instead of the long or short translate. To accomplish this instead of dragging the record column to the grid to add the column I used the insert menu and added a edit box. Then set the properties of the new dummy column to your record and field.

Wednesday, November 5, 2014

Poeplecode Record toString method

Record toString method

This may be one of my favorite shortcuts I've created. For logging or debug it will give you the entire contents of any record in a string. Just like the Java toString class method.

Example


Local Record &rec = CreateRecord(Record.ADM_APPL_PROG);
rem populate record with some values;
MessageBox(0, "", 0, 0, " To String function : %1 ", recToString(&rec));
The output looks like this:
To String function : EARLY_FA_OFFER[abc123,1111,22,12345678,33,2014-11-05,1,4444,55.5]

Function


Function recToString(&R) Returns string;
   Local number &f;
   Local string &txt = &R.name | "[";
   
   For &f = 1 To &R.FieldCount
      If &f > 1 Then
         &txt = &txt | ","
      End-If;
      &txt = &txt | &R.getfield(&f).value;
   End-For;
   
   Return &txt | "]";
End-Function;