Monday, 3 December 2012

comments fields to outbound as xl file:

While comments fields to outbound as xl file, we will face some problems because of tabs ,new line chars and special chars so I searched in internet and I fund some logic and I added some logic to that code Below is code this will help adding commets to xl file

Function F2(&String As string) Returns string
Local string &sCurrChar, &sTmpStr;
Local number &nPos, &nLen;
Local string &VALID = "~`!#$%^&*()_|\{}[]:'<>?\/"; /* Special chars can be allowed */

&sStr = &String; &sTmpStr = RTrim(LTrim(&sStr));
 /* Trim blank spaces before and after string */
 If IsAlphaNumeric(&sTmpStr) Or IsDigits(&sTmpStr) Then
/* Return String if already IsAlphanNumeric */
       Return &sTmpStr;
Else
     &sTmpStr = Substitute(&sTmpStr, "-", "_");
     &nLen = Len(&sTmpStr);
    /* Get Length of string */
      &nPos = 1;
  /* Set initial position */
 While &nPos <= &nLen   
/* Loop through string one character at a time and strip out non alpha character. */

 &sCurrChar = Substring(&sTmpStr, &nPos, 1);
 /* Get one character from string at the current position */
 If IsAlphaNumeric(&sCurrChar) Then
/* Check if alpha character or space */
&nPos = &nPos + 1; /* Increment current position */

Else &V = Find(&sCurrChar, &VALID);
/* Leave spaces and some Special chars inside of string */
If &sCurrChar = " " Or &V > 0 Then
&nPos = &nPos + 1;
 /* Increment current position */
Else
    If &nPos < &nLen Then
       &sTmpStr = Substring(&sTmpStr, 1, &nPos - 1) | Substring(&sTmpStr, &nPos + 1, &nLen - &nPos);
/* Remove non-alpha character */
 &nLen = Len(&sTmpStr);
/* Get new length of string */
             Else /* Last character */
                     Return Substring(&sTmpStr, 1, &nPos - 1);
/* Return string without last character */
End-If;
 End-If;
End-If;
End-While;
End-If;
Return &sTmpStr;
End-Function;

Tuesday, 11 September 2012

Adding and updating data into record in peoplecode
&variable_name= CreateRecord(Record.Record_name);
&variable_name.field_name.value= data
&variable_name.field_name2.value= data
/*to insert new row*/
&variable_name.Insert()
/*to update existing data*/
&variable_name.update()
Note: when doing update key field’s data required
          If with same key fields data is already exist in table insert will not work

To get field name of that record

For &i = 1 To &variable_name.FieldCount
   &fn = &variable_nameGetField(&i).Name;

Sunday, 22 July 2012


Creating structure (columns) from other table:   

To get only structure not data use below SQL

CREATE TABLE new_table
  AS (SELECT * FROM old_table WHERE 1=2)

 If you want data also

CREATE TABLE new_table
  AS (SELECT * FROM old_table)

Friday, 20 July 2012

Clicking of push button XL to CI :


Some times we will get requirement like this in a page click of push button is mandatory, so if you create XL to CI to the you have to include that push button field in that CI, then in  XL to CI give input as ‘Y’ so it’ll work

Thursday, 19 July 2012

Warning: Application Engine Request is not active -- processing suspended (108,517):

 Some times when we try to schedule an application engine through AE it gives above error. & the process goes into success. It actually does not execute the application engine
  
 you have to  set the process frequency to "Always" in below page and then schedule process

Home > PeopleTools > Application Engine > Process > Request

 

Friday, 13 July 2012

Enable and Disable add and delete Buttons in Scroll:


 To enable and disable add/delete button using people code

Example With bit logic
 Local Rowset &PCS_CMP_HDR;
 & CMP_HDR = GetLevel0()(1).GetRowset(Scroll.PER_ROL_REC);
If &CMP_HDR(CurrentRowNumber()).PER_ROL_REC.WF_STATUS.Value = "A" Then
   &CMP_HDR.InsertEnabled = True;
Else
   &CMP_HDR.InsertEnabled = True;
End-If;

In front end  also you can do
1.


2.

Note:
 
In Scroll if all field all fields display only automatically add/deletions will become display only
to avoid this you have to make put at least one filed in editable and make visible property false

Monday, 11 June 2012

Writing Inline Queries using PS Query Tool

To achive this we can use SQL objects
appdesigner create SQL object with in line select statement
use this SQL as exprestion in PSQuery
click on Add Expresstion


In Expresstion test place give SQL(Name of SQL Object) like ( %SQL(V_TEST))

click on save and then click on use it as field