Find SendMail Peoplecode - peoplesoft
We have custom functionality in PeopleSoft FSCM that generates an email notification with a link to direct users to approve vouchers online. I have found part of the text string variable that compose the email message within the following Record PeopleCode, however I can not seem to find where the actual outbound email object is created and Send method is being called and using the &EMAIL_TEXT variable. I've done Find In searches for the variable but that has not led me to the code that generates the emails. Any suggestions for how to find it is appreciated!
Here is the code snippet with the email body variable:
&EMAIL_TEXT = "Please review and take approval action for the following:" | Char(10) | "Business Unit: " | VCHR_APPRVL.BUSINESS_UNIT.Value | Char(10) | "Voucher ID: " | VCHR_APPRVL.VOUCHER_ID | Char(10) | Char(10) | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | "The following hyperlink will take you to the voucher approval page:" | Char(10);
&URL = GenerateComponentPortalURL("EMPLOYEE", Node.ERP, MenuName.ENTER_VOUCHER_INFORMATION, "GBL", Component.VCHR_APPROVE, Page.VCHR_APPRVL_WF, "U", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID);
&EMAIL_TEXT = &EMAIL_TEXT | &URL | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | "Questions pertaining to this data should be directed to AccountsPayable_GH#guthrie.org" | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | "****DO NOT REPLY TO THIS EMAIL AS THIS ACCOUNT IS NOT MONITORED****" | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
GH_VCHR_APR_WRK.EMAILTEXT.Value = &EMAIL_TEXT;
Here is the entire Record PeopleCode (for context) on the field BUSPROCNAME with the SaveEdit action:
Declare Function virtual_approver PeopleCode APPR_VA0_WRK.FUNCLIB_01 FieldFormula;
Declare Function get_roleuser PeopleCode APPR_VA0_WRK.ROLEUSER FieldChange;
Declare Function get_message_text PeopleCode WF_FUNCLIB_WRK.FUNCLIB_01 FieldFormula;
Component boolean &overrideapprover;
Function get_denial_role();
&SETID = GetSetId(Field.BUSINESS_UNIT, VCHR_APPRVL.BUSINESS_UNIT, Record.BUS_UNIT_OPT_AP, "");
&CURRDATE = %Date;
SQLExec("Select a.rolename from ps_bus_unit_opt_ap a where a.setid = :1 and a.effdt = (Select max(b.effdt) from ps_bus_unit_opt_ap b where b.setid = :2 and b.effdt <= %datein(:3) and b.eff_status = 'A')", &SETID, &SETID, &CURRDATE, APPR_FIELDS_WRK.ROLENAME);
End-Function;
Function get_deptid(&BU, &Voucher_ID, &Dept_Cnt, &DEPTID);
Local SQL &SQL_DEPTID;
&Dept_Cnt = 0;
/* If &VOUCHER_STYLE = "JRNL" Or
&VOUCHER_STYLE = "CORR" Or
&VOUCHER_STYLE = "ADJ" Then
MessageBox(0, "", 0, 0, "Jrnl or Adj or Reversal. So assigning 99999", 0);
&DEPTID = "99999";
&Dept_Cnt = 1;
Else */
SQLExec("SELECT DEPTID FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", &BU, &Voucher_ID, &DEPTID);
If All(&DEPTID) Then
&Dept_Cnt = 1;
Else
&SQL_DEPTID = CreateSQL("SELECT DISTINCT DEPTID FROM PS_DISTRIB_LINE A, PS_PO_LINE B WHERE A.BUSINESS_UNIT = :1 AND VOUCHER_ID = :2 AND A.BUSINESS_UNIT_PO = B.BUSINESS_UNIT AND A.PO_ID = B.PO_ID AND A.LINE_NBR = B.LINE_NBR AND B.RECV_REQ <> 'Y'", &BU, &Voucher_ID);
While &SQL_DEPTID.Fetch(&DEPTID_Fetch)
&Dept_Cnt = &Dept_Cnt + 1;
&DEPTID = &DEPTID_Fetch;
End-While;
End-If;
rem End-If;
End-Function;
/* ---------------- beginning of mainline --------------------------*/
/* ICE 597971000 - TMG - 06/17/03 */
/* Check if nothing has changed on the approval status */
If Not FieldChanged(VCHR_APPRVL.APPR_STATUS) Then
Error MsgGet(7045, 5, "The approval status has not been changed/updated, page cannot be saved until the approval status has been modified.!");
End-If;
If VCHR_APPRVL.APPR_STATUS = "D" And
VCHR_FS.APPR_INSTANCE = 0 Then
Error MsgGet(7045, 7, "The voucher cannot be Denied until it has been routed.");
End-If;
/* ICE 531713000 - TMG - 12/13/02 */
/* Check if voucher status has changed */
rem SQLExec("SELECT ENTRY_STATUS, CLOSE_STATUS, PROCESS_MAN_CLOSE FROM PS_VOUCHER WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &ENTRY_STATUS, &CLOSE_STATUS, &PROCESS_MAN_CLOSE);
SQLExec("SELECT ENTRY_STATUS, CLOSE_STATUS, PROCESS_MAN_CLOSE, VOUCHER_STYLE FROM PS_VOUCHER WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &ENTRY_STATUS, &CLOSE_STATUS, &PROCESS_MAN_CLOSE, &VOUCHER_STYLE);
If &ENTRY_STATUS = "P" And
&CLOSE_STATUS <> "C" And
&PROCESS_MAN_CLOSE <> "Y" Then
/* Check if worklist item has been cancelled */
&INSTANCEID = %WLInstanceId;
If All(&INSTANCEID) Then
SQLExec("SELECT MAX(A.ACTIVITYNAME), MAX(A.EVENTNAME), MAX(A.WORKLISTNAME) FROM PS_VCHR_WL1 A, PSWORKLIST B WHERE A.BUSPROCNAME = B.BUSPROCNAME AND A.ACTIVITYNAME = B.ACTIVITYNAME AND A.EVENTNAME = B.EVENTNAME AND A.WORKLISTNAME = B.WORKLISTNAME AND A.INSTANCEID = B.INSTANCEID AND A.BUSPROCNAME = :1 AND A.BUSINESS_UNIT = :2 AND A.VOUCHER_ID = :3 AND A.INSTANCEID = :4", VCHR_APPRVL.BUSPROCNAME, VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &INSTANCEID, &ACTIVITYNAME, &EVENTNAME, &WORKLISTNAME);
SQLExec("SELECT INSTSTATUS FROM PSWORKLIST WHERE BUSPROCNAME = :1 AND ACTIVITYNAME = :2 AND EVENTNAME = :3 AND WORKLISTNAME = :4 AND INSTANCEID = :5", VCHR_APPRVL.BUSPROCNAME, &ACTIVITYNAME, &EVENTNAME, &WORKLISTNAME, &INSTANCEID, &INSTSTATUS);
If &INSTSTATUS = 3 Then
Error MsgGet(7045, 4, "Voucher approval status cannot be changed because worklist item has been cancelled.")
End-If;
End-If;
Else
Error MsgGet(7045, 3, "Voucher approval status cannot be changed because voucher status has changed.");
End-If;
/* If (APPR_STATUS = "A" And
%MessageAgent = "") Or
(APPR_STATUS = "P" And
%MessageAgent <> "") Then */
If VCHR_APPRVL.APPR_STATUS = "A" And
%CompIntfcName <> "" Or
VCHR_APPRVL.APPR_STATUS = "D" Then
If &overrideapprover = True Then
rem &OPRID = ""; /*custom commented this line and added the next*/
&OPRID = VCHR_FS.OPRID;
Else
&OPRID = %OperatorId;
End-If;
get_roleuser(&OPRID, &EMAILID, &FORMID, &EMPLID, &ROLEUSER);
rem the following four fields are required;
APPR_FIELDS_WRK.BUSPROCNAME = VCHR_APPRVL.BUSPROCNAME;
APPR_FIELDS_WRK.APPR_RULE_SET = VCHR_APPRVL.APPR_RULE_SET;
APPR_FIELDS_WRK.ROLEUSER = &ROLEUSER;
APPR_FIELDS_WRK.APPR_INSTANCE = VCHR_APPRVL.APPR_INSTANCE;
SQLExec("SELECT GH_BUSINESS_UNIT_O FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", &BU, &Voucher_ID, &GH_BUSINESS_UNIT_O); */
SQLExec("SELECT GH_BUSINESS_UNIT_O FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &GH_BUSINESS_UNIT_O);
VCHR_APPRVL_WRK.GH_BUSINESS_UNIT_O.Value = &GH_BUSINESS_UNIT_O;
get_deptid(VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &Dept_Cnt, &DEPTID);
&EMAIL_TEXT = "Please review and take approval action for the following:" | Char(10) | "Business Unit: " | VCHR_APPRVL.BUSINESS_UNIT.Value | Char(10) | "Voucher ID: " | VCHR_APPRVL.VOUCHER_ID | Char(10) | Char(10) | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | "The following hyperlink will take you to the voucher approval page:" | Char(10);
&URL = GenerateComponentPortalURL("EMPLOYEE", Node.ERP, MenuName.ENTER_VOUCHER_INFORMATION, "GBL", Component.VCHR_APPROVE, Page.VCHR_APPRVL_WF, "U", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID);
&EMAIL_TEXT = &EMAIL_TEXT | &URL | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | "Questions pertaining to this data should be directed to AccountsPayable_GH#guthrie.org" | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | "****DO NOT REPLY TO THIS EMAIL AS THIS ACCOUNT IS NOT MONITORED****" | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
GH_VCHR_APR_WRK.EMAILTEXT.Value = &EMAIL_TEXT;
If None(&DEPTID) Then
REM VCHR_APPRVL_WRK.DEPTID.Value = "99999";
MessageBox(0, "", 0, 0, "No Deptid. So assigning 99999", 0);
VCHR_APPRVL_WRK.DEPTID.Value = "99999";
Else
VCHR_APPRVL_WRK.DEPTID.Value = &DEPTID;
End-If;
If VCHR_APPRVL.APPR_STATUS = "D" Then
APPR_FIELDS_WRK.APPR_ACTION = "D";
Else
APPR_FIELDS_WRK.APPR_ACTION = "A";
End-If;
If VCHR_APPRVL.APPR_STATUS = "A" Then
VCHR_APPRVL.APPR_STATUS = "P";
End-If;
virtual_approver();
If &overrideapprover = True Then
&overrideapprover = False;
End-If;
VCHR_APPRVL.APPR_CHECK_FLG = "Y";
rem;
VCHR_APPRVL.APPR_STATUS = APPR_FIELDS_WRK.APPR_STATUS;
remark set up the message for e-mail if denied;
If VCHR_APPRVL.APPR_STATUS = "D" Then
&LANGUAGE_CD = PSOPTIONS.LANGUAGE_CD;
&MESSAGE_SET_NBR = 7045;
&MESSAGE_NBR = 2;
&BIND1 = VCHR_FS.BUSINESS_UNIT | "/" | VCHR_FS.VOUCHER_ID;
&BIND2 = APPR_FIELDS_WRK.ROLEUSER;
&BIND3 = VCHR_FS.VENDOR_ID | ", " | VENDOR.NAME1;
&BIND4 = VCHR_FS.INVOICE_ID | " (" | VCHR_FS.INVOICE_DT | ")";
&BIND5 = VCHR_FS.GROSS_AMT | "(" | VCHR_FS.TXN_CURRENCY_CD | ")";
get_message_text(&MESSAGE_SET_NBR, &MESSAGE_NBR, &BIND1, &BIND2, &BIND3, &BIND4, &BIND5, &MESSAGE_TEXT, &DESCRLONG);
UpdateValue(VCHR_APPRVL_MSG.EMAIL_SUBJECT_LONG, 1, &DESCRLONG);
UpdateValue(VCHR_APPRVL_MSG.EMAIL_TEXTLONG, 1, &MESSAGE_TEXT);
remark get the role to send denials to;
get_denial_role();
VCHR_APPRVL_WRK.RTE_CNTL_TYPE1 = "Business Unit";
VCHR_APPRVL_WRK.RTE_CNTL_TYPE2 = "Administrative Area";
VCHR_APPRVL_WRK.WF_ADMIN_AREA = "AP";
VCHR_APPRVL_WRK.ROLENAME = APPR_FIELDS_WRK.ROLENAME;
End-If;
End-If;
The email text is being saved into a work record field, so the sendmail call doesn't have to be in this event. (It isn't in the code you provided)
In the Component Processor Flow, after SaveEdit there's SavePreChange, Workflow and SavePostChange, but since it is saved in a work record, it's also possible that additional user input is required after the Save Processing flow and therefor it could literally be anywhere.
Related
Rows to columns in azure data explorer (kusto)
I have a simple query: let startDate = ago(7d); let endDate = now(); let all_logs = materialize(MyTable | where TIMESTAMP > startDate and TIMESTAMP < endDate | where EventName == "SessionResult"); all_logs | summarize Total_Sessions = count(), Successful_Sessions = countif(Successful == "True"), Failed_Sessions = countif(Successful == "False") | extend Success_Rate = round(100.0*Successful_Sessions/Total_Sessions, 2) Which returns How can I change this to: Label Count Rate Total_sessions 98 100 Successful_session 96 97.96 Failed_session 2 2.04 preferably without using the pivot plugin
you could try using the narrow() plugin: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/narrowplugin For example: let T = materialize( MyTable | where TIMESTAMP > startDate and TIMESTAMP < endDate | where EventName == "SessionResult") | summarize Total_Sessions = count(), Successful_Sessions = countif(Successful == "True"), Failed_Sessions = countif(Successful == "False") ) ; let total = toscalar(T | project total_sessions) ; T | evaluate narrow() | project Label = Column, Count = Value, Rate = round(100.0 * tolong(Value) / total, 2)
How to insert multiple check checked/unchecked boxes value into database from aspxgridview checkbox dataitemtemplate?
I'm trying to insert multiple checked/unchecked box value into database via submit button. after the submit button is clicked, the one or multiple checked check box value will be inserted into database first and followed by checked/unchecked images will appear on the clicked check boxes (which checked image represents value 1 and unchecked image represents value 0. ) Problem : I have tried the method below but only able to insert one check box value into database, for the outcome the check box appeared as number instead of checked/unchecked image and required to refresh the page for the checked/unchecked images to appear. Aspx <dx:ASPxComboBox ID="year" runat="server" AutoPostBack="true" ClientInstanceName="year" ValueType="System.Int32" Width="100px" CssClass="ddstyle mr10px" OnSelectedIndexChanged="SelectedIndexChanged"></dx:ASPxComboBox> <dx:ASPxComboBox ID="month" runat="server" AutoPostBack="true" ClientInstanceName="month" ValueType="System.Int32" Width="100px" CssClass="ddstyle mr10px" OnSelectedIndexChanged="SelectedIndexChanged"></dx:ASPxComboBox> <dx:ASPxComboBox ID="section" runat="server" AutoPostBack="true" ValueType="System.String" Width="100px" CssClass="ddstyle" OnSelectedIndexChanged="SelectedIndexChanged"></dx:ASPxComboBox> </div> </div> <dx:ASPxGridView ID="LeaveSystem" runat="server" AutoGenerateColumns="false" KeyFieldName="EMP_NO;Year;Month" Width="100%"> <SettingsBehavior AllowDragDrop="false" AllowSort="false" /> <SettingsPager Mode="ShowAllRecords" /> </dx:ASPxGridView> <asp:UpdateProgress ID="GeneralUpdateProgress" ClientIDMode="Static" runat="server"> <ProgressTemplate> <img id="gupLoading" src="../images/loadingscreen.gif" /> </ProgressTemplate> </asp:UpdateProgress> </ContentTemplate> </asp:UpdatePanel> <dx:ASPxCallback ID="cb" ClientInstanceName="cb" runat="server" OnCallback="cb_Callback" ></dx:ASPxCallback> <dx:ASPxLabel ID="HiddenEmpID" runat="server" ClientInstanceName="HiddenEmpID" ClientVisible="false"></dx:ASPxLabel> <dx:ASPxButton ID="submitbtn" runat="server" Text="Submit" Visible="true" OnClick="submitbtn_Click" AutoPostBack="false"></dx:ASPxButton> VB.net Sub CustomCheckBoxColumn(ByVal fieldName As String) Dim c As New GridViewDataColumn c.DataItemTemplate = New CheckBoxTemplate c.FieldName = fieldName Dim dayOfDate As New DateTime dayOfDate = getDate(fieldName) c.Caption = c.FieldName + vbNewLine + Replace(dayOfDate.ToString("dddd"), "??", "") c.HeaderStyle.HorizontalAlign = HorizontalAlign.Center c.CellStyle.HorizontalAlign = HorizontalAlign.Center LeaveSystem.Columns.Add(c) End Sub Function getDate(ByVal fieldName As String) As DateTime Dim chosenDate As New DateTime chosenDate = Convert.ToDateTime(year.Value.ToString() + "-" + month.Value.ToString() + "-" + fieldName) Return chosenDate End Function Protected Sub SelectedIndexChanged(sender As Object, e As EventArgs) LeaveSystem.DataBind() End Sub Private Sub LeaveSystem_DataBinding(sender As Object, e As EventArgs) Handles LeaveSystem.DataBinding LeaveSystem.Columns.Clear() Dim sql As String = "" If section.Value.ToString() = "PT" Then sql = "select * from tb1" Else sql = "select * from tb2" End If Dim dt As New DataTable dt = GetMssql(sql) LeaveSystem.DataSource = dt Dim a As New GridViewDataColumn a.FieldName = "EMP_NO" a.Caption = "EMPID" LeaveSystem.Columns.Add(a) Dim b As New GridViewDataColumn b.FieldName = "CHI_NAME" b.Caption = "CNAME" LeaveSystem.Columns.Add(b) Dim fieldName As String = "" Dim lastDay As New Integer lastDay = DateTime.DaysInMonth(DirectCast(year.Value, Integer), DirectCast(month.Value, Integer)) For i = 1 To lastDay If i.ToString().Length = 1 Then fieldName = "0" + i.ToString() Else fieldName = i.ToString End If CustomCheckBoxColumn(fieldName) Next End Sub Friend Class CheckBoxTemplate Implements ITemplate Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn Dim checkbox As New ASPxCheckBox Dim gridContainer As GridViewDataItemTemplateContainer = CType(container, GridViewDataItemTemplateContainer) 'Dim empid As String = gridContainer.Grid.GetRowValues(gridContainer.VisibleIndex, "EmpID").ToString() checkbox.AllowGrayed = False checkbox.CheckedImage.Url = "images/checked_image.png" checkbox.UncheckedImage.Url = "images/unchecked_image.png" checkbox.CssClass += "customcheckbox" checkbox.ID = "DateCheckBox" Dim list As New ArrayList list.Add(checkbox.Checked) Dim x As String For Each x In list checkbox.ClientSideEvents.CheckedChanged = String.Format("function (s, e) {{ cb.PerformCallback(HiddenEmpID.GetValue() + '|' + year.GetValue() + '|' + month.GetValue() + '|' + '{0}|' + s.GetChecked(""" & x & """)); }}", gridContainer.Column.FieldName) checkbox.Value = DataBinder.Eval(gridContainer.DataItem, gridContainer.Column.FieldName) If checkbox.Value = 1 Then checkbox.Checked = True Else checkbox.Checked = False End If checkbox.ValueType = GetType(Int32) checkbox.ValueUnchecked = 0 checkbox.ValueChecked = 1 Next container.Controls.Add(checkbox) End Sub End Class Protected Sub cb_Callback(source As Object, e As CallbackEventArgs) Session("par") = e.Parameter.Split("|"c) End Sub Protected Sub submitbtn_Click(sender As Object, e As EventArgs) If IsPostBack Then Dim p() As String = Session("par") p(1) = Session("year") p(2) = Session("month") 'Dim p() As String = e.Parameter.Split("|"c) 'p(0) = empid, p(1) = year, p(2) = month, p(3) = Date, p(4) = Boolean Dim list As New ArrayList list.Add(p(3)) If p(4) = True Then p(4) = "1" Else p(4) = "0" End If Dim x As String For Each x In list Dim query As String = String.Format("UPDATE LeaveSystem SET [{3}] = '{4}', UpdateTime = GETDATE() WHERE EmpID = '{0}' and Year = '{1}' and Month = '{2}' IF ##ROWCOUNT=0 INSERT INTO LeaveSystem (EmpID, Year, Month, [{3}], UpdateTime) values ('{0}', '{1}', '{2}', '{4}', GETDATE())", p(0), p(1), p(2), x, p(4)) SetMssql(query) Next End If End Sub Expected Result YEAR : 2019 MONTH: 4 ------------------------------------------------------------------ |EMP NO| 1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|.....| ------------------------------------------------------------------ | 234 |v | | | | | | | | | | | | | |v | | | | | |.....| ------------------------------------------------------------------- -->| 456 | v| | | | | | | | | | |v | v| v| | v| | | | |.....| ------------------------------------------------------------------ (Submit) (cancel) Actual Result YEAR : 2019 MONTH: 4 ------------------------------------------------------------------ |EMP NO| 1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|.....| ------------------------------------------------------------------ | 234 | 1| | | | | | | | | | | | | | 1| | | | | |.....| ------------------------------------------------------------------- -->| 456 | 1| | | | | | | | | | |1 | | 1| 0| 1| | | | |.....| ------------------------------------------------------------------ (Submit) (cancel)
I don't know about VB.net. I am a PHP Developer. but in this multiple radio check buttons value. <form method="POST" action="submit.php" > <input type="checkbox" name="gender" value="male" /> <input type="checkbox" name="gender" value="female" /> <input type="submit" name="submit" value="submit"> </form> $_POST['gender']={male,female}; ````````````````````` after submitting the form you will get an array of this multiple radio check value. that's it.
Error in Peoplcode ScrollSelect processing
When I'm trying to open the page I get the error that "Return: 8011 - SQL statment is too long". We have about millions of rows. On the page we are filling the scroll and the where statement is created something like this For &i = 1 To &rs.ActiveRowCount &PARAM1 = &rs(&i).Record.SETID.Value; &PARAM2 = &rs(&i).Record.VENDOR_ID.Value; &strWhere = &strWhere | " OR "; &strWhere = &strWhere | "(SETID = " | "'" |(&PARAM1) | "'" | " AND VENDOR_ID = " | "'" |(&PARAM2) | "'" | ")"; End-for; Is there a limit while doing a Scroll select?
Take the SQL that populated &rs. Modify your SQL that uses &strWhere that it joins to the &rs record, which is filtered the same as you populated &rs. It's a little tricky to explain because you'll need to change more than just your code snippet. Modify your code so it does something more like this: &strWhere = ", PS_SOME_RECORD b where b.keyfield_1 = :1 and b.keyfield_2 = :2 "; &strWhere = &strWhere | "and b.setid = a.setid "; &strWhere = &strWhere | "and b.vendorid = a.vendorid"; Same same but different: &strWhere = " inner join PS_SOME_RECORD b on b.setid = a.setid and b.vendor_id = a.vendor_id "; &strWhere = &strWhere | "and b.keyfield_1 = :1 and b.keyfield_2 = :2"; Basically: use the database instead of trying to build up a 1,000,000 line SQL statement. Ultimately you want to return from the database (assuming VENDOR table) something not unlike: select * from ps_vendor a inner join ps_your_rs_table b on b.setid = a.setid and b.vendor_id = a.vendor_id where b.some_field = [your filter/predicates]
this is due to the length of the value passed in where condition "IN". Since the data value passed in IN ("") exceeds the limit, hence it results in this error.
JavaCC: encountered... Was expecting one of... error
I'm getting this error when trying to run a parser written in JavaCC on a sample (syntactically valid) file: Exception in thread "main" ParseException: Encountered "8;" at line 13, column 17. Was expecting one of: <INT_CONST> ... "<" ...at jimpleParser.generateParseException(jimpleParser.java:2421) at jimpleParser.jj_consume_token(jimpleParser.java:2292) at jimpleParser.expr(jimpleParser.java:1038) (shortened for conciseness) I cannot work out why it is throwing an error. "8" should be a valid token. Here is the function in question: String expr(): { Token t1 = null, t2 = null; String f1 = null, f2 = null, f3 = null; } { (LOOKAHEAD(3) f1 = imm() {System.out.println(f1);} | f1 = new_expr() | t1 = <LBR> f2 = nonvoid_type() t2 = <RBR> f3 = imm() {f1 = t1.image.concat(f2.concat(t2.image.concat(f3)));} | LOOKAHEAD(2) f2 = imm() t1 = <INSTANCEOF> f3 = nonvoid_type() {f1 = f2.concat(t1.image.concat(f3));} | f1 = invoke_expr() | LOOKAHEAD(2) f1 = reference() | LOOKAHEAD(2) f1 = binop_expr() | f1 = unop_expr()) {return f1;} } which should in turn call imm shown here: String imm(): { String f1 = null; } { (f1 = constant() | f1 = local_name()) {return f1;} } which should in turn call constant shown here: String constant(): { Token t1 = null, t2 = null; String f1 = null; } { (t1 = <INT_CONST> {f1 = t1.image; System.out.println(f1);} | t1 = <FLOAT_CONST> {f1 = t1.image;} | t1 = <MIN_INT_CONST> {f1 = t1.image;} | t1 = <MIN_FLOAT_CONST> {f1 = t1.image;} | t1 = <STRING_CONST> {f1 = t1.image;} | t1 = <CLASS> t2 = <STRING_CONST> {f1 = t1.image.concat(t2.image);} | t1 = <NULL> {f1 = t1.image;}) {return f1;} } 8 should be an INT_CONST. Relevant token specifications are shown here: <INT_CONST: ((<OCT_CONST> | <DEC_CONST> | <HEX_CONST>) ("L")?)> <DEC_CONST: (<DEC_DIGIT>)+> <DEC_DIGIT: ["0"-"9"]> Any help would be much appreciated. Thanks
Note that it is not "8" that is causing the problem, but "8;". Although "8" is an INT_CONST, "8;" is not. So the longest match rule is kicking in and some other token production that does match "8;" is winning. See the FAQ http://www.engr.mun.ca/~theo/JavaCC-FAQ/ question 3.3. Without seeing all of your .jj file, I can't tell you which token it is, but if you put a break point on the code that constructs the error message you can easily see what the .kind field of the unexpected token holds.
Try this in your token section, it would definitely solve your problem: TOKEN: { <DEC_DIGIT: (["0"-"9"])> | <INT_CONST: ((<OCT_CONST> | <DEC_CONST> | <HEX_CONST>) ("L")?)> | <DEC_CONST: (<DEC_DIGIT>)+> // The rest of your tokens.... }
Datatable calendar on VisualBasic
I have a request to show a grid similar to a calendar showing on columns the day and on row months. Something like this Month |Sun|Mon|Tue|Wed|Thu|Fri|Sat|Sun|Mon|Tue|Wed|Thu|Fri|Sat|Sun|Mon|Tue|Wed|...|Thu| January | 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11|...................| 31| Febrary | | | | 1| 2| 3| 4| 5| 6| 7|...........................| 29| ... December| 30| 31| | | | | 1| 2| 3| 4|............................ Is there a way to do this, considering that The Start day of the year must be the real day name, not a constant and this must be generated dynamically I try this but my idea goes off! Private Sub GenerateCalendar(ByVal year As Integer) Dim colsCount As Integer = 3 If Bisiesto(año) Then colsCount = colsCount + 366 Else colsCount = colsCount + 365 End If Dim dtCalendar As New DataTable dtCalendar.Columns.Add("Mes") Dim dayMonthYear As Date = New Date(year , 1, 1) 'Showing the distribution of the first month While dayMonthYear.Year = año And dayMonthYear.Month = 1 Dim dtColumn As DataColumn = New DataColumn() dtColumn.ColumnName = WeekdayName(Weekday(dayMonthYear)) & dayMonthYear.Day & dayMonthYear.Month dtColumn.Caption = WeekdayName(Weekday(dayMonthYear)) dtCalendar.Columns.Add(dtColumn) dayMonthYear = diaMesAño.AddDays(1) End While Dim row As DataRow = dtCalendario.NewRow() 'Here I need to distribute the days on its column day dtCalendario.Rows.Add(row) wdgCalendario.DataSource = dtCalendar wdgCalendario.DataBind() End Sub Public Function LeapYear(ByVal year As Integer) Dim isLeapYear As Boolean = False If year Mod 4 = 0 Then If (year Mod 100 = 0) And Not (year Mod 400 = 0) Then isLeapYear = False Else isLeapYear = True End If Else isLeapYear = False End If Return isLeapYear End Function
Note: You cannot have duplicate column names in the DataTable, so i have appended the weekday with the number of week in month. But see it for yourself: Private Function GetCalendarTable(year As Int32) As DataTable Dim curCulture = System.Globalization.CultureInfo.CurrentCulture Dim firstYearDate = New Date(year, 1, 1) Dim currentDate = firstYearDate Dim tblCalendar = New DataTable tblCalendar.Columns.Add(New DataColumn("MonthName")) Dim maxDiff = 0 For m = 1 To 12 'find max difference between first year's weekday and month's first weekday 'if the latter is earlier in the week, it is considered to be in the next week Dim monthFirstWeekDay = New Date(year, m, 1).DayOfWeek Dim diff = (7 + (monthFirstWeekDay - firstYearDate.DayOfWeek)) Mod 7 If diff > maxDiff Then maxDiff = diff End If Next Dim weekDayNum = curCulture.Calendar.GetDaysInMonth(year, 1) + maxDiff ' Create DataColumns with weekday as ColumnsName For wd = 1 To weekDayNum Dim weekday = currentDate.ToString("ddd") Dim weekInMonth = (From col In tblCalendar.Columns.Cast(Of DataColumn)() Where col.ColumnName Like String.Format("{0} W#", weekday)).Count + 1 Dim columnName = String.Format("{0} W{1}", weekday, weekInMonth) tblCalendar.Columns.Add(New DataColumn(columnName)) currentDate = currentDate.AddDays(1) Next ' Create the DataRows(every month) For m = 1 To 12 Dim daysInMonth = curCulture.Calendar.GetDaysInMonth(year, m) Dim firstMonthDate = New Date(year, m, 1) Dim daysBefore = (7 + (firstMonthDate.DayOfWeek - firstYearDate.DayOfWeek)) Mod 7 Dim daysBehind = tblCalendar.Columns.Count - (daysBefore + daysInMonth) - 1 Dim monthDays = From d In Enumerable.Range(1, daysInMonth) Select New With {.Day = d.ToString} Dim emptyDaysBefore = From d In Enumerable.Range(1, daysBefore) Select New With {.Day = ""} Dim emptyDaysAfter = From d In Enumerable.Range(1, daysBehind) Select New With {.Day = ""} Dim monthName = curCulture.DateTimeFormat.GetMonthName(m) ' piece together parts Dim allFields = ({New With {.Day = monthName}}. Union(emptyDaysBefore). Union(monthDays). Union(emptyDaysAfter). Select(Function(d) d.Day)).ToArray tblCalendar.Rows.Add(allFields) Next Return tblCalendar End Function