For getting the OprID for the current session then write the following below line of code in Record Level Save PreChange Event
SRI_STUORG4_TBL.SRI_STUORG_OPRID = %UserId;
Showing posts with label PepleCode. Show all posts
Showing posts with label PepleCode. Show all posts
Thursday, August 13, 2009
select any check box in the Grid then the remaning check boxes in the same column should hide automatically
Level 0 = Org ID,Name
Level 1 = Org details
Level 2 = 3 Grids (Active locations,Primary Contact,Active Departments)
When we select any check box then the remaning check boxes in the same column should hide automatically.And the corresponding Name (Active locations,Primary Contact,Active Departments)which is in grid should be displayed in the Corresponding fields.
Write the following below code in the Component Record Level Field change event.
Local Rowset &RS0, &RS1, &RS2, &rs4;
&RS0 = GetLevel0();
&RS1 = &RS0(1).GetRowset(Scroll.SRI_STUORG1_TBL);
&CNT = 0;
For &I = 1 To &RS1.ActiveRowCount
&RS2 = &RS1(&I).GetRowset(Scroll.SRI_STUORG3_TBL);
For &J = 1 To &RS2.ActiveRowCount
&chk = &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value;
&cr = CurrentRowNumber(2);
If &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "Y" Then
&id = &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_CONTACTNO).Value;
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARYCOU).Value = &id;
&CNT = &CNT + 1;
For &p = 1 To &RS2.ActiveRowCount
REM WinMessage("in for ", 0);
&RS2.GetRow(&p).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = False;
End-For;
&RS2.GetRow(&cr).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = True;
REM WinMessage("count " | &CNT, 0);
End-If;
If &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "N" And
&CNT = 0 Then
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARYCOU).Value = &id;
REM WinMessage("in if1", 0);
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = True;
End-If;
If &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "N" And
&CNT > 0 Then
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARYCOU).Value = &id;
If &J <> &cr And
&RS2.GetRow(&cr).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "Y" Then
REM WinMessage("in if2", 0);
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = False;
End-If;
If &RS2.GetRow(&cr).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "N" Then
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARYCOU).Value = &id;
For &u = 1 To &RS2.ActiveRowCount
REM WinMessage("in if2", 0);
&RS2.GetRow(&u).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = True;
End-For;
End-If;
End-If;
End-For;
End-For;
Level 1 = Org details
Level 2 = 3 Grids (Active locations,Primary Contact,Active Departments)
When we select any check box then the remaning check boxes in the same column should hide automatically.And the corresponding Name (Active locations,Primary Contact,Active Departments)which is in grid should be displayed in the Corresponding fields.
Write the following below code in the Component Record Level Field change event.
Local Rowset &RS0, &RS1, &RS2, &rs4;
&RS0 = GetLevel0();
&RS1 = &RS0(1).GetRowset(Scroll.SRI_STUORG1_TBL);
&CNT = 0;
For &I = 1 To &RS1.ActiveRowCount
&RS2 = &RS1(&I).GetRowset(Scroll.SRI_STUORG3_TBL);
For &J = 1 To &RS2.ActiveRowCount
&chk = &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value;
&cr = CurrentRowNumber(2);
If &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "Y" Then
&id = &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_CONTACTNO).Value;
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARYCOU).Value = &id;
&CNT = &CNT + 1;
For &p = 1 To &RS2.ActiveRowCount
REM WinMessage("in for ", 0);
&RS2.GetRow(&p).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = False;
End-For;
&RS2.GetRow(&cr).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = True;
REM WinMessage("count " | &CNT, 0);
End-If;
If &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "N" And
&CNT = 0 Then
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARYCOU).Value = &id;
REM WinMessage("in if1", 0);
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = True;
End-If;
If &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "N" And
&CNT > 0 Then
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARYCOU).Value = &id;
If &J <> &cr And
&RS2.GetRow(&cr).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "Y" Then
REM WinMessage("in if2", 0);
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = False;
End-If;
If &RS2.GetRow(&cr).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "N" Then
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARYCOU).Value = &id;
For &u = 1 To &RS2.ActiveRowCount
REM WinMessage("in if2", 0);
&RS2.GetRow(&u).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = True;
End-For;
End-If;
End-If;
End-For;
End-For;
Tuesday, August 11, 2009
Fill color in grid Cell
FOR &Z = 1 TO &RS.ACTIVEROWCOUNT
&RS(&Z).RSRECNAME.RECFIELDNAME.Style = "STYLEVALUE";
END-FOR
&RS(&Z).RSRECNAME.RECFIELDNAME.Style = "STYLEVALUE";
END-FOR
Date display format on Page
In Order to change the date format through Personalization, please follow the steps given below:
1. Navigate, Root > People Tools > Personalization > Personalization Options > Search
Here, you will get the option for the different application for which you want to change the Date Format or you can also choose PPTL (People Tools) which change the Date Format in the Tools itself. Select, PPTL.
2. Now, you can see there is a Definition---> DFRMT, for the Date Format.
3. On the Top of this page and beside the Definition Tab, you will find the Format Tab, just click on this Tab.
4. Now, click on the "Set Option Default Value".
5. Change the Option Default Value as per your requirement MMDDYY and click OK.
6. Save the changes.
========================================
========================================
If you want to change the Date Format for a Specific User on specific page then you can also do this through People Coding.
You can also play with the below code with the help of %oprid, like if %oprid then the below code or w.r.t roles through "IsUserInRole" function.
There is one built-in function "DateTimeToLocalizedString". You can use this if you want to change the date format through people code for your PIA pages.
How to use:
Example 1:
&String = DateTimeToLocalizedString(&Date, "M/d/y");
/* if you are picking the date from any record field and using &Date for that field */
Example 2:
&String = DateTimeToLocalizedString(%Date, "M/d/y");
/* if you want to pick the system date and want to use it on your page with different formats. */
-- Assign this String variable (&String) to your desired field.
Note: Here 'd' for date and 'y' for year both must be in smaller letters only. And, 'M' for months should be in Caps.
1. Navigate, Root > People Tools > Personalization > Personalization Options > Search
Here, you will get the option for the different application for which you want to change the Date Format or you can also choose PPTL (People Tools) which change the Date Format in the Tools itself. Select, PPTL.
2. Now, you can see there is a Definition---> DFRMT, for the Date Format.
3. On the Top of this page and beside the Definition Tab, you will find the Format Tab, just click on this Tab.
4. Now, click on the "Set Option Default Value".
5. Change the Option Default Value as per your requirement MMDDYY and click OK.
6. Save the changes.
========================================
========================================
If you want to change the Date Format for a Specific User on specific page then you can also do this through People Coding.
You can also play with the below code with the help of %oprid, like if %oprid then the below code or w.r.t roles through "IsUserInRole" function.
There is one built-in function "DateTimeToLocalizedString". You can use this if you want to change the date format through people code for your PIA pages.
How to use:
Example 1:
&String = DateTimeToLocalizedString(&Date, "M/d/y");
/* if you are picking the date from any record field and using &Date for that field */
Example 2:
&String = DateTimeToLocalizedString(%Date, "M/d/y");
/* if you want to pick the system date and want to use it on your page with different formats. */
-- Assign this String variable (&String) to your desired field.
Note: Here 'd' for date and 'y' for year both must be in smaller letters only. And, 'M' for months should be in Caps.
For getting the current DAteTime when ever we change or edit any field i
Write the following below code in the Record Level in Save Prechange
Local Rowset &RS0, &RS1, &RS2;
&RS0 = GetLevel0();
&RS1 = &RS0(1).GetRowset(Scroll.SRI_STUORG1_TBL);
For &I = 1 To &RS1.ActiveRowCount
&RS2 = &RS1(&I).GetRowset(Scroll.SRI_STUORG4_TBL);
For &J = 1 To &RS2.ActiveRowCount
If &RS2.GetRow(&J).IsChanged Then
&RS2.GetRow(&I).GetRecord(Record.SRI_STUORG4_TBL).GetField(Field.SRI_STUORG_DTTIME).Value = %Datetime;
End-If;
End-For;
End-For;
Local Rowset &RS0, &RS1, &RS2;
&RS0 = GetLevel0();
&RS1 = &RS0(1).GetRowset(Scroll.SRI_STUORG1_TBL);
For &I = 1 To &RS1.ActiveRowCount
&RS2 = &RS1(&I).GetRowset(Scroll.SRI_STUORG4_TBL);
For &J = 1 To &RS2.ActiveRowCount
If &RS2.GetRow(&J).IsChanged Then
&RS2.GetRow(&I).GetRecord(Record.SRI_STUORG4_TBL).GetField(Field.SRI_STUORG_DTTIME).Value = %Datetime;
End-If;
End-For;
End-For;
Sunday, August 9, 2009
Inserting a New Scroll Row from within the Same Scroll
In PeopleCode, when inserting or deleting a row on a scroll, it is required that you perform the action on a parent row of the rowset being inserted/deleted to. PeopleTools doesn’t allow PeopleCode (using the built-in functions/methods InsertRow and DeleteRow) to insert or delete a row on the same scroll within which it is currently running. If you attempt to do this, PeopleTools will give an error complaining about changing the current program context.
However, there are some cases where inserting within the same scroll might be desirable. For example, based on the data entered on a row of a scroll, a new matching row must be inserted within the same scroll.
Background
The Rowset class has a SelectNew method, which is quite similar to the Select method. The main difference is that rows populated through SelectNew are marked as new in the component buffer. Both Select and SelectNew allows the record source of the data being loaded to the rowset to be different from the primary record of the rowset. There is a requirement, however, that the source record must contain at least one of the key fields in the primary record. Though, none of the fields in the source record have to be keys as well.
The Technique
Step 1. Create a new Dynamic View record containing at least one of the keys of the primary record of the scroll. For this tutorial, assume that the name of the new record is SCROLL_INS_ROW. This is important: none of the fields in this record must be set to a key.
Step 2. Set the SQL of the view to the following:
SELECT NULL
FROM PS_INSTALLATION
Of course, if you’ve included more fields, then SELECT the appropriate number of NULL’s on the SQL.
Step 3. The PeopleCode for inserting a row within the same scroll would be the following:
Local Rowset &this_rowset = GetRowset();
&this_rowset.SelectNew(Record.SCROLL_INS_ROW);
However, there are some cases where inserting within the same scroll might be desirable. For example, based on the data entered on a row of a scroll, a new matching row must be inserted within the same scroll.
Background
The Rowset class has a SelectNew method, which is quite similar to the Select method. The main difference is that rows populated through SelectNew are marked as new in the component buffer. Both Select and SelectNew allows the record source of the data being loaded to the rowset to be different from the primary record of the rowset. There is a requirement, however, that the source record must contain at least one of the key fields in the primary record. Though, none of the fields in the source record have to be keys as well.
The Technique
Step 1. Create a new Dynamic View record containing at least one of the keys of the primary record of the scroll. For this tutorial, assume that the name of the new record is SCROLL_INS_ROW. This is important: none of the fields in this record must be set to a key.
Step 2. Set the SQL of the view to the following:
SELECT NULL
FROM PS_INSTALLATION
Of course, if you’ve included more fields, then SELECT the appropriate number of NULL’s on the SQL.
Step 3. The PeopleCode for inserting a row within the same scroll would be the following:
Local Rowset &this_rowset = GetRowset();
&this_rowset.SelectNew(Record.SCROLL_INS_ROW);
Month difference PeopleCode
Function diff_months(&DATE1 As date, &DATE2 As date) Returns number;
Local integer &YEAR1 = Year(&DATE1);
Local integer &MONTH1 = Month(&DATE1);
Local integer &DAY1 = Day(&DATE1);
Local integer &YEAR2 = Year(&DATE2);
Local integer &MONTH2 = Month(&DATE2);
Local integer &DAY2 = Day(&DATE2);
If &DATE1 <= &DATE2 Then
If &DAY1 > &DAY2 Then
If &MONTH1 = 12 Then
&MONTH1 = 1;
&YEAR1 = &YEAR1 + 1;
Else
&MONTH1 = &MONTH1 + 1;
End-If;
End-If;
Else
If &DAY1 < &DAY2 Then
If &MONTH2 = 12 Then
&MONTH2 = 1;
&YEAR2 = &YEAR2 + 1;
Else
&MONTH2 = &MONTH2 + 1;
End-If;
End-If;
End-If;
Local integer &DIFF_MONTHS = 12 * (&YEAR2 - &YEAR1) + &MONTH2 - &MONTH1;
Return &DIFF_MONTHS;
End-Function;
Local integer &YEAR1 = Year(&DATE1);
Local integer &MONTH1 = Month(&DATE1);
Local integer &DAY1 = Day(&DATE1);
Local integer &YEAR2 = Year(&DATE2);
Local integer &MONTH2 = Month(&DATE2);
Local integer &DAY2 = Day(&DATE2);
If &DATE1 <= &DATE2 Then
If &DAY1 > &DAY2 Then
If &MONTH1 = 12 Then
&MONTH1 = 1;
&YEAR1 = &YEAR1 + 1;
Else
&MONTH1 = &MONTH1 + 1;
End-If;
End-If;
Else
If &DAY1 < &DAY2 Then
If &MONTH2 = 12 Then
&MONTH2 = 1;
&YEAR2 = &YEAR2 + 1;
Else
&MONTH2 = &MONTH2 + 1;
End-If;
End-If;
End-If;
Local integer &DIFF_MONTHS = 12 * (&YEAR2 - &YEAR1) + &MONTH2 - &MONTH1;
Return &DIFF_MONTHS;
End-Function;
Date related calucations
Local date &From_Date, &To_Dt;
&Duration = 0;
&Tot_Holi = 0;
&Sat = 0;
&Sun = 0;
&From_Dt = SRI_STUMOD_TBL.SRI_STUAB_STD.Value;
&To_Dt = SRI_STUMOD_TBL.SRI_STUAB_END.Value;
While (&From_Dt <= &To_Dt);
&From_Dt = AddToDate(&From_Dt, 0, 0, 1);
If (Weekday(&From_Dt) = 7) Then
&Sat = &Sat + 1;
End-If;
If (Weekday(&From_Dt) = 1) Then
&Sun = &Sun + 1;
End-If;
If Weekday(&From_Dt) <> 7 And
Weekday(&From_Dt) <> 1 And
&flag <> "x" Then
&Duration = &Duration + 1;
End-If;
SQLExec("select 'x' from PS_HOLIDAY_DATE WHERE HOLIDAY=:1", &From_Dt, &flag);
If &flag = "x" Then
&Tot_Holi = &Tot_Holi + 1;
End-If;
End-While;
SRI_STUMOD_TBL.SRI_STUAB_SAT.Value = &Sat;
&Sat = 0;
SRI_STUMOD_TBL.SRI_STUAB_SUN.Value = &Sun;
&Sun =0;
SRI_STUMOD_TBL.SRI_STUAB_DURATION.Value = &Duration;
&Duration = 0;
&Tot_Holi = 0;
&Sat = 0;
&Sun = 0;
&From_Dt = SRI_STUMOD_TBL.SRI_STUAB_STD.Value;
&To_Dt = SRI_STUMOD_TBL.SRI_STUAB_END.Value;
While (&From_Dt <= &To_Dt);
&From_Dt = AddToDate(&From_Dt, 0, 0, 1);
If (Weekday(&From_Dt) = 7) Then
&Sat = &Sat + 1;
End-If;
If (Weekday(&From_Dt) = 1) Then
&Sun = &Sun + 1;
End-If;
If Weekday(&From_Dt) <> 7 And
Weekday(&From_Dt) <> 1 And
&flag <> "x" Then
&Duration = &Duration + 1;
End-If;
SQLExec("select 'x' from PS_HOLIDAY_DATE WHERE HOLIDAY=:1", &From_Dt, &flag);
If &flag = "x" Then
&Tot_Holi = &Tot_Holi + 1;
End-If;
End-While;
SRI_STUMOD_TBL.SRI_STUAB_SAT.Value = &Sat;
&Sat = 0;
SRI_STUMOD_TBL.SRI_STUAB_SUN.Value = &Sun;
&Sun =0;
SRI_STUMOD_TBL.SRI_STUAB_DURATION.Value = &Duration;
Date related calucations using rowsets
Local Rowset &RS0, &RS1;
Local date &From_Date, &To_Dt;
&Duration = 0;
&Tot_Holi = 0;
&Sat = 0;
&Sun = 0;
&RS0 = GetLevel0();
&RS1 = &RS0(1).GetRowset(Scroll.SRI_STUMOD_TBL);
For &I = 1 To &RS1.ActiveRowCount
&From_Date=&RS1(I).GetRecord(Record.SRI_STUMOD_TBL).GetField(Field.SRI_STUAB_STD).Value;
&To_Dt =&RS1(&I).GetRecord(Record.SRI_STUMOD_TBL).GetField(Field.SRI_STUAB_END).Value;
While (&From_Date <= &To_Dt);
If (Weekday(&From_Date) = 7) Then
&Sat = &Sat + 1;
End-If;
If (Weekday(&From_Date) = 1) Then
&Sun = &Sun + 1;
End-If;
If Weekday(&From_Date) <> 7 And
Weekday(&From_Date) <> 1 And
&flag <> "x" Then
&Duration = &Duration + 1;
End-If;
&From_Date = AddToDate(&From_Date, 0, 0, 1);
End-While;
&RS1(&I).GetRecord(Record.SRI_STUMOD_TBL).GetField(Field.SRI_STUAB_DURATION).Value = &Duration;
If &Duration > 20 Then
Error MsgGet(11100, 180, "Only 20 leaves per annum please select the correct dates");
End-If;
&RS1(&I).GetRecord(Record.SRI_STUMOD_TBL).GetField(Field.SRI_STUAB_SAT).Value = &Sat;
WinMessage(&Sat, 0);
&Sat = 0;
&RS1(&I).GetRecord(Record.SRI_STUMOD_TBL).GetField(Field.SRI_STUAB_SUN).Value = &Sun;
&Sun = 0;
End-For;
Local date &From_Date, &To_Dt;
&Duration = 0;
&Tot_Holi = 0;
&Sat = 0;
&Sun = 0;
&RS0 = GetLevel0();
&RS1 = &RS0(1).GetRowset(Scroll.SRI_STUMOD_TBL);
For &I = 1 To &RS1.ActiveRowCount
&From_Date=&RS1(I).GetRecord(Record.SRI_STUMOD_TBL).GetField(Field.SRI_STUAB_STD).Value;
&To_Dt =&RS1(&I).GetRecord(Record.SRI_STUMOD_TBL).GetField(Field.SRI_STUAB_END).Value;
While (&From_Date <= &To_Dt);
If (Weekday(&From_Date) = 7) Then
&Sat = &Sat + 1;
End-If;
If (Weekday(&From_Date) = 1) Then
&Sun = &Sun + 1;
End-If;
If Weekday(&From_Date) <> 7 And
Weekday(&From_Date) <> 1 And
&flag <> "x" Then
&Duration = &Duration + 1;
End-If;
&From_Date = AddToDate(&From_Date, 0, 0, 1);
End-While;
&RS1(&I).GetRecord(Record.SRI_STUMOD_TBL).GetField(Field.SRI_STUAB_DURATION).Value = &Duration;
If &Duration > 20 Then
Error MsgGet(11100, 180, "Only 20 leaves per annum please select the correct dates");
End-If;
&RS1(&I).GetRecord(Record.SRI_STUMOD_TBL).GetField(Field.SRI_STUAB_SAT).Value = &Sat;
WinMessage(&Sat, 0);
&Sat = 0;
&RS1(&I).GetRecord(Record.SRI_STUMOD_TBL).GetField(Field.SRI_STUAB_SUN).Value = &Sun;
&Sun = 0;
End-For;
Thursday, July 30, 2009
Derived/ Work record
When we want to call another component (The fields(Student ID and Name) in level 3 should be displayed in the other page fields)when we click on the hyperlink or Push button in Grid then
1.Create the Derived/ Work record with appropriate fields(Make sure that they are key fields).
2.Put the fields in the level 0 in both the pages.
3.Assign the values(Student ID and Name)
4.Use the Domaodalcomponent function
SYNTAX:DoModalComponent(MENUNAME.menuname, BARNAME.barname, ITEMNAME.menuitem_name, PAGE.component_item_name, action, RECORD.shared_record_name [, keylist])
1.Create the Derived/ Work record with appropriate fields(Make sure that they are key fields).
2.Put the fields in the level 0 in both the pages.
3.Assign the values(Student ID and Name)
4.Use the Domaodalcomponent function
SYNTAX:DoModalComponent(MENUNAME.menuname, BARNAME.barname, ITEMNAME.menuitem_name, PAGE.component_item_name, action, RECORD.shared_record_name [, keylist])
To know the Menu,Bar,Item name's to use in Transfer,Transfer Exact,Domodal component
To know the Menu,Bar,Item name's to use in Transfer,Transfer Exact,Domodal component(when we click on the hyper link or push button in grid to transfer to another component) use the following below SQL
select *
from PSAUTHITEM
where MENUNAME = 'your menu name'
and PNLITEMNAME = 'your page name'
select *
from PSAUTHITEM
where MENUNAME = 'your menu name'
and PNLITEMNAME = 'your page name'
Sunday, July 19, 2009
Friday, June 26, 2009
To write Images along with HTML text into a file created in an App Engine in PeopleSoft
It's possible to write images along with HTML text.
Sample Code:
1. Create a new HTML Object as follows:
!html <>
!body
!img src="cid:23abc@pc27" /
!/html
!/body
cid stands for the Content Id
2. Sample PeopleCode:
Local string &STRLURL = GetURL(URL.IMG_PATH);
&image.SetAttachmentContent(&STRLURL, %FilePath_Absolute, "sample.jpg", "This is a sample image!", "", "");
/* The Content ID in the code (Highlighted) must be same as Content ID in HTML */
&image.AddHeader("Content-ID", "23abc@pc27");
We have used this to display html image and text in email notifications. You could try it for documents and let us know if it works for you.
Sample Code:
1. Create a new HTML Object as follows:
!html <>
!body
!img src="cid:23abc@pc27" /
!/html
!/body
cid stands for the Content Id
2. Sample PeopleCode:
Local string &STRLURL = GetURL(URL.IMG_PATH);
&image.SetAttachmentContent(&STRLURL, %FilePath_Absolute, "sample.jpg", "This is a sample image!", "", "");
/* The Content ID in the code (Highlighted) must be same as Content ID in HTML */
&image.AddHeader("Content-ID", "23abc@pc27");
We have used this to display html image and text in email notifications. You could try it for documents and let us know if it works for you.
Reasons why PeopleSoft does not recomd SQLEXEC()
PS does not recommend sqlexec(), to avoid direct database calls. As the main reason for 3 tier architecture was to execute the business logic on the application server so that the application can be made database independent. This means if you want to change the database of any application from one vendor to another, you should be able to do it easily.
If you use sqlexec() calls, this purpose is not met as you may use sql which is very specific to the database. However if you use Peoplesoft way of creating a record, for example
RC_CASE is record with key as CASE_ID
Local record &lrec = createrecord(record.rc_case);
&lrec.case_id.value = 123;
Now if you want to select from RC_CASE, you would use sqlexec() as sqlexec("select case_closed from ps_rc_case where case_id=:1",123,&caseclos);
Instead you can also use the record instance as
&lrec.selectbykey();
The above will populate the rc_case record with all the values and you can use it. Also in this case Peoplesoft forms the sql based on the database, so if the organization using this application decides to change the database from Oracle to MS-SQL Server, you will not have to change the code for above.
If you use sqlexec() calls, this purpose is not met as you may use sql which is very specific to the database. However if you use Peoplesoft way of creating a record, for example
RC_CASE is record with key as CASE_ID
Local record &lrec = createrecord(record.rc_case);
&lrec.case_id.value = 123;
Now if you want to select from RC_CASE, you would use sqlexec() as sqlexec("select case_closed from ps_rc_case where case_id=:1",123,&caseclos);
Instead you can also use the record instance as
&lrec.selectbykey();
The above will populate the rc_case record with all the values and you can use it. Also in this case Peoplesoft forms the sql based on the database, so if the organization using this application decides to change the database from Oracle to MS-SQL Server, you will not have to change the code for above.
Subscribe to:
Posts (Atom)