Different result from pcl::MomentOfInertiaEstimation and pcl::CropBox? - point-cloud-library

I am trying to get an OBB from a point cloud, and I have got a right result using pcl::MomentOfInertiaEstimation method .I want to extract the points from the OBB using CropBox, but I got much less points than original point cloud ,maybe there's something wrong in my rotation vector:v, I'm not quiet sure. Can anyone help me? 
struct BoundingBox{ 
        pcl::PointXYZ min_point_OBB; 
        pcl::PointXYZ max_point_OBB; 
        pcl::PointXYZ position_OBB; 
        Eigen::Matrix3f rotational_matrix_OBB; 
        pcl::PointXYZ center; 
        pcl::PointXYZ x_axis; 
        pcl::PointXYZ y_axis; 
        pcl::PointXYZ z_axis; 
}; 
BoundingBox getOBB(pcl::PointCloud<pcl::PointXYZ>::Ptr  cloud,BoundingBox OBB ) 
{ 
  pcl::MomentOfInertiaEstimation <pcl::PointXYZ> feature_extractor; 
  feature_extractor.setInputCloud (cloud); 
  feature_extractor.compute (); 
  feature_extractor.getOBB (OBB.min_point_OBB, OBB.max_point_OBB, OBB.position_OBB, OBB.rotational_matrix_OBB); 
 return OBB; 
}   
int main(void){ 
BoundingBox OBB; 
OBB=getOBB(Npoints,OBB);                   //Npoints is a part of the whole cloud 
Eigen::Quaternionf quat (OBB.rotational_matrix_OBB); 
Eigen::Vector3f position (OBB.position_OBB.x, OBB.position_OBB.y, OBB.position_OBB.z); 
 pcl::visualization::PCLVisualizer viewer; 
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> points_color_handler (cloud, 255, 255, 255); 
 viewer.addCube (position, quat, OBB.max_point_OBB.x - OBB.min_point_OBB.x, OBB.max_point_OBB.y - OBB.min_point_OBB.y, OBB.max_point_OBB.z - OBB.min_point_OBB.z,"OBB"); 
viewer.setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_REPRESENTATION, pcl::visualization::PCL_VISUALIZER_REPRESENTATION_WIREFRAME,"OBB"); 
////////////////above result is correct//////////////////// 
 Eigen::Vector4f max_point_OBB(OBB.max_point_OBB.x,OBB.max_point_OBB.y,OBB.max_point_OBB.z,1.0); 
Eigen::Vector4f min_point_OBB(OBB.min_point_OBB.x,OBB.min_point_OBB.y,OBB.min_point_OBB.z,1.0); 
pcl::PointCloud<pcl::PointXYZ>::Ptr cloudOut (new pcl::PointCloud<pcl::PointXYZ>); 
pcl::CropBox<pcl::PointXYZ> boxfilter; 
boxfilter.setMax(max_point_OBB);         
boxfilter.setMin(min_point_OBB); 
Eigen::Vector3f v = quat.vec(); 
boxfilter.setTranslation(position); 
boxfilter.setRotation(v); 
boxfilter.setInputCloud(cloud); 
boxfilter.filter (*cloudOut); 
 /////////cloulOut includes much less points than Npoints///////// 
looking for an answer! 

//boxfilter.setTranslation(position);
//boxfilter.setRotation(v);
Eigen::Translation3f translation(position_OBB.x, position_OBB.y, position_OBB.z);
Eigen::Matrix3f rotationMatrixOOB = quat.toRotationMatrix();
Eigen::Affine3f affine3f = translation * rotational_matrix_OBB;
boxfilter.setTransform(affine3f.inverse());

Related

Adding Application Insights on Blazor Client (Web Assembly)

I am wanting to add application insights sdk into a blazor web assembly project. I came across multiple articles such as Application Insights for web pages and stackoverflow that has the exact thing I am looking for. However, after adding the snippet of code from the microsoft link and using connectionString over instrumentationKey to the index.html page and injecting IJSRuntime in order to call JavaScript methods from .NET code then calling Application Inisghts methods... when running the application at the top of the home page I will see #inject IJSRuntime _jsRuntime.
Am I not properly setting up the injecting? Also, do I need to add these lines of code into each razor component (page folder) or just having it in the index.html will cover everything from the start to end no matter what I click and what page is rendered?
Index.html
#inject IJSRuntime _jsRuntime
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
!function (T, l, y) { var S = T.location, k = "script", D = "connectionString", C = "ingestionendpoint", I = "disableExceptionTracking", E = "ai.device.", b = "toLowerCase", w = "crossOrigin", N = "POST", e = "appInsightsSDK", t = y.name || "appInsights"; (y.name || T[e]) && (T[e] = t); var n = T[t] || function (d) { var g = !1, f = !1, m = { initialize: !0, queue: [], sv: "5", version: 2, config: d }; function v(e, t) { var n = {}, a = "Browser"; return n[E + "id"] = a[b](), n[E + "type"] = a, n["ai.operation.name"] = S && S.pathname || "_unknown_", n["ai.internal.sdkVersion"] = "javascript:snippet_" + (m.sv || m.version), { time: function () { var e = new Date; function t(e) { var t = "" + e; return 1 === t.length && (t = "0" + t), t } return e.getUTCFullYear() + "-" + t(1 + e.getUTCMonth()) + "-" + t(e.getUTCDate()) + "T" + t(e.getUTCHours()) + ":" + t(e.getUTCMinutes()) + ":" + t(e.getUTCSeconds()) + "." + ((e.getUTCMilliseconds() / 1e3).toFixed(3) + "").slice(2, 5) + "Z" }(), iKey: e, name: "Microsoft.ApplicationInsights." + e.replace(/-/g, "") + "." + t, sampleRate: 100, tags: n, data: { baseData: { ver: 2 } } } } var h = d.url || y.src; if (h) { function a(e) { var t, n, a, i, r, o, s, c, u, p, l; g = !0, m.queue = [], f || (f = !0, t = h, s = function () { var e = {}, t = d.connectionString; if (t) for (var n = t.split(";"), a = 0; a < n.length; a++) { var i = n[a].split("="); 2 === i.length && (e[i[0][b]()] = i[1]) } if (!e[C]) { var r = e.endpointsuffix, o = r ? e.location : null; e[C] = "https://" + (o ? o + "." : "") + "dc." + (r || "services.visualstudio.com") } return e }(), c = s[D] || d[D] || "", u = s[C], p = u ? u + "/v2/track" : d.endpointUrl, (l = []).push((n = "SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details)", a = t, i = p, (o = (r = v(c, "Exception")).data).baseType = "ExceptionData", o.baseData.exceptions = [{ typeName: "SDKLoadFailed", message: n.replace(/\./g, "-"), hasFullStack: !1, stack: n + "\nSnippet failed to load [" + a + "] -- Telemetry is disabled\nHelp Link: https://go.microsoft.com/fwlink/?linkid=2128109\nHost: " + (S && S.pathname || "_unknown_") + "\nEndpoint: " + i, parsedStack: [] }], r)), l.push(function (e, t, n, a) { var i = v(c, "Message"), r = i.data; r.baseType = "MessageData"; var o = r.baseData; return o.message = 'AI (Internal): 99 message:"' + ("SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details) (" + n + ")").replace(/\"/g, "") + '"', o.properties = { endpoint: a }, i }(0, 0, t, p)), function (e, t) { if (JSON) { var n = T.fetch; if (n && !y.useXhr) n(t, { method: N, body: JSON.stringify(e), mode: "cors" }); else if (XMLHttpRequest) { var a = new XMLHttpRequest; a.open(N, t), a.setRequestHeader("Content-type", "application/json"), a.send(JSON.stringify(e)) } } }(l, p)) } function i(e, t) { f || setTimeout(function () { !t && m.core || a() }, 500) } var e = function () { var n = l.createElement(k); n.src = h; var e = y[w]; return !e && "" !== e || "undefined" == n[w] || (n[w] = e), n.onload = i, n.onerror = a, n.onreadystatechange = function (e, t) { "loaded" !== n.readyState && "complete" !== n.readyState || i(0, t) }, n }(); y.ld < 0 ? l.getElementsByTagName("head")[0].appendChild(e) : setTimeout(function () { l.getElementsByTagName(k)[0].parentNode.appendChild(e) }, y.ld || 0) } try { m.cookie = l.cookie } catch (p) { } function t(e) { for (; e.length;)!function (t) { m[t] = function () { var e = arguments; g || m.queue.push(function () { m[t].apply(m, e) }) } }(e.pop()) } var n = "track", r = "TrackPage", o = "TrackEvent"; t([n + "Event", n + "PageView", n + "Exception", n + "Trace", n + "DependencyData", n + "Metric", n + "PageViewPerformance", "start" + r, "stop" + r, "start" + o, "stop" + o, "addTelemetryInitializer", "setAuthenticatedUserContext", "clearAuthenticatedUserContext", "flush"]), m.SeverityLevel = { Verbose: 0, Information: 1, Warning: 2, Error: 3, Critical: 4 }; var s = (d.extensionConfig || {}).ApplicationInsightsAnalytics || {}; if (!0 !== d[I] && !0 !== s[I]) { var c = "onerror"; t(["_" + c]); var u = T[c]; T[c] = function (e, t, n, a, i) { var r = u && u(e, t, n, a, i); return !0 !== r && m["_" + c]({ message: e, url: t, lineNumber: n, columnNumber: a, error: i }), r }, d.autoExceptionInstrumented = !0 } return m }(y.cfg); function a() { y.onInit && y.onInit(n) } (T[t] = n).queue && 0 === n.queue.length ? (n.queue.push(a), n.trackPageView({})) : a() }(window, document, {
src: "https://js.monitor.azure.com/scripts/b/ai.2.min.js", // The SDK URL Source
// name: "appInsights", // Global SDK Instance name defaults to "appInsights" when not supplied
// ld: 0, // Defines the load delay (in ms) before attempting to load the sdk. -1 = block page load and add to head. (default) = 0ms load after timeout,
// useXhr: 1, // Use XHR instead of fetch to report failures (if available),
crossOrigin: "anonymous", // When supplied this will add the provided value as the cross origin attribute on the script tag
// onInit: null, // Once the application insights instance has loaded and initialized this callback function will be called with 1 argument -- the sdk instance (DO NOT ADD anything to the sdk.queue -- As they won't get called)
cfg: { // Application Insights Configuration
connectionString: "CONNECTIONSTRING_KEY_GOES_HERE"
/* ...Other Configuration Options... */
}
});
</script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>BlazorWeb</title>
<base href="/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/app.css" rel="stylesheet" />
<link href="BlazorWeb.styles.css" rel="stylesheet" />
</head>
<body>
<div id="app">Loading...</div>
<div id="blazor-error-ui">
An unhandled error has occurred.
Reload
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.webassembly.js"></script>
</body>
await _jsRuntime.InvokeVoidAsync("appInsights.trackPageView");
</html>
Injecting the Application Insights for Blazor web applications. Steps to be followed
Add BlazorApplicationInsights
Nuget
dotnet add package BlazorApplicationInsights
Add call to Program.cs
builder.Services.AddBlazorApplicationInsights();
Add using statement to _Imports.razor
#using BlazorApplicationInsights;
Add component to App.razor
<ApplicationInsightsComponent />
Add Application Insights JS to head in index.html
Source
Set 'ld: -1' so that the page will be blocked until the JS is loaded and enter your instrumentationKey
Add the Source like below screenshot
Add JS Interop to the bottom of body in index.html
I can see the Track Event button which I was used.
Also, I can see the custom Event in Application Insights.
Refer here

Applying function to specific columns of dataframes in list

I have a list of dataframes with common columns that I need to merge, but I need to coerce certain columns to character type first prior to merging. To fix this, I wrote the following:
master_list <- lapply(master_list, function(x) x %>%
                     mutate_at(.vars = vars(master_list$x$'send date',
                                            master_list$x$'send time',
                                            master_list$x$'Monthly',
                                            master_list$x$'InteractionEventDate'),
                               .funs = as.character))
However, when I look at these columns in any one dataframe in my list, the change was not made (e.g. InteractionEventDate is still a double), despite no error being thrown by the above line of code. I based it partially on the answer to this post, which used the now deprecated mutate_each.
Your approach is a bit roundabout here. So maybe first define a function using dplyr logic and then lapply it over the list?
premerge <- function(df){
df %>%
mutate_at(.vars = c("send date","send time", "Monthly","InteractionEventDate"), .funs = as.character)
}
lappyl(master_list,premerge)

Find SendMail Peoplecode

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.

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.

Show items in dropdownlist that is not equal to the selected item in other dropdownlist

Example I have 5 DropDownList with values
red, orange, yellow, green, blue
if DropDownList1 select red
The choices for DropDownList2-5 will be
orange, yellow, green, blue
if DropDownList2 select yellow
The choices for DropDownList3-5 will be
orange, green, blue
Here is the code I found in the internet, this is only for 3 DropDownList but what I need is for 5 DropDownList. I can't expand the code for 5 DropDownList
VB
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Private bFlag As Boolean = True
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
FillddlLocations()
End If
End Sub
'Properties to store selected value in ViewState
Protected Property MemberID1Selection() As String
Get
If ViewState("MemberID1Selection") IsNot Nothing Then
Return ViewState("MemberID1Selection").ToString()
End If
Return ""
End Get
Set(value As String)
ViewState("MemberID1Selection") = value
End Set
End Property
Protected Property MemberID2Selection() As String
Get
If ViewState("MemberID2Selection") IsNot Nothing Then
Return ViewState("MemberID2Selection").ToString()
End If
Return ""
End Get
Set(value As String)
ViewState("MemberID2Selection") = value
End Set
End Property
Protected Property MemberID3Selection() As String
Get
If ViewState("MemberID3Selection") IsNot Nothing Then
Return ViewState("MemberID3Selection").ToString()
End If
Return ""
End Get
Set(value As String)
ViewState("MemberID3Selection") = value
End Set
End Property
Protected Sub FillddlLocations()
FillDropdown(companyID1)
FillDropdown(companyID2)
FillDropdown(companyID3)
companyID1.Visible = True
companyID2.Visible = True
companyID3.Visible = True
End Sub
Protected Sub FillDropdown(ddl As DropDownList)
Using connAdd = New SqlConnection("Data Source = MENDOZAABBY-PC\SQLEXPRESS; Initial Catalog = ThesisDatabase; Integrated Security= True")
connAdd.Open()
Dim sql = "SELECT CompanyName FROM Company Where College = 'CCS'"
Using cmdAdd = New SqlDataAdapter(sql, connAdd)
Dim ds2 As New DataSet()
cmdAdd.Fill(ds2)
ddl.Items.Clear()
ddl.DataSource = ds2
ddl.DataTextField = "CompanyName"
ddl.DataValueField = "CompanyName"
ddl.DataBind()
ddl.Items.Insert(0, New ListItem("Please select a Company", ""))
ddl.SelectedIndex = 0
End Using
End Using
End Sub
Protected Sub IndexChanged(ddlChanged As DropDownList, ddlToFilter1 As DropDownList, ddlToFilter2 As DropDownList)
Dim removeValue1 As String = If(ddlChanged Is companyID1, MemberID1Selection, (If(ddlChanged Is companyID2, MemberID2Selection, MemberID3Selection)))
Dim selValue2 As String = If(ddlChanged Is companyID1, MemberID2Selection, (If(ddlChanged Is companyID2, MemberID1Selection, MemberID1Selection)))
Dim selValue3 As String = If(ddlChanged Is companyID1, MemberID3Selection, (If(ddlChanged Is companyID2, MemberID3Selection, MemberID2Selection)))
bFlag = False
'Prevent fireing the code again while changing the index
If removeValue1 <> "" Then
Dim item1 As ListItem = ddlToFilter1.Items.FindByValue(removeValue1)
ddlToFilter1.Items.Remove(item1)
Dim item2 As ListItem = ddlToFilter2.Items.FindByValue(removeValue1)
ddlToFilter2.Items.Remove(item2)
End If
If selValue3 <> "" Then
Dim item3 As ListItem = ddlToFilter1.Items.FindByValue(selValue3)
ddlToFilter1.Items.Remove(item3)
End If
If selValue2 <> "" Then
Dim item4 As ListItem = ddlToFilter2.Items.FindByValue(selValue2)
ddlToFilter2.Items.Remove(item4)
End If
bFlag = False
ddlToFilter1.SelectedIndex = ddlToFilter1.Items.IndexOf(ddlToFilter1.Items.FindByValue(selValue2))
ddlToFilter2.SelectedIndex = ddlToFilter2.Items.IndexOf(ddlToFilter2.Items.FindByValue(selValue3))
End Sub
Protected Sub ddlpid1_SelectedIndexChanged(sender As Object, e As EventArgs)
MemberID1Selection = companyID1.SelectedValue
If bFlag Then
FillDropdown(companyID2)
FillDropdown(companyID3)
IndexChanged(companyID1, companyID2, companyID3)
End If
End Sub
Protected Sub ddlpid2_SelectedIndexChanged(sender As Object, e As EventArgs)
MemberID2Selection = companyID2.SelectedValue
If bFlag Then
FillDropdown(companyID1)
FillDropdown(companyID3)
IndexChanged(companyID2, companyID1, companyID3)
End If
End Sub
Protected Sub ddlpid3_SelectedIndexChanged(sender As Object, e As EventArgs)
MemberID3Selection = companyID3.SelectedValue
If bFlag Then
FillDropdown(companyID1)
FillDropdown(companyID2)
IndexChanged(companyID3, companyID1, companyID2)
End If
End Sub
End Class
ASPX
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="companyID1" AutoPostBack="true" runat="server" Visible="false" OnSelectedIndexChanged="ddlpid1_SelectedIndexChanged">
</asp:DropDownList>
<asp:DropDownList ID="companyID2" AutoPostBack="true" runat="server" Visible="false" OnSelectedIndexChanged="ddlpid2_SelectedIndexChanged">
</asp:DropDownList>
<asp:DropDownList ID="companyID3" AutoPostBack="true" runat="server" Visible="false" OnSelectedIndexChanged="ddlpid3_SelectedIndexChanged" >
</asp:DropDownList>
</div>
</form>
</body>
</html>
Let Me give you an idea, which will work. Create a matrix object. It could be an array.
Items -> | red | orange | yellow | green |
Controls | | | | |
| | | | | |
V | | | | |
_________|______|________|________|_______|
combo1 |true | false | true |true |
_________|______|________|________|_______|
combo2 |true | false | true |true |
_________|______|________|________|_______|
combo3 |true | false | true |true |
_________|______|________|________|_______|
combo4 |true | true | true |true |
_________|______|________|________|_______|
Update:
According to this matrix your interface will have combo4 items - All, other combos will only have red, yellow and green.
when combo3 is clicked next and, for example, yellow selected you will fill the cell "combo3/yellow" with "true" and other remaining cells under yellow - "false".
Items -> | red | orange | yellow | green |
Controls | | | | |
| | | | | |
V | | | | |
_________|______|________|________|_______|
combo1 |true | false | false |true |
_________|______|________|________|_______|
combo2 |true | false | false |true |
_________|______|________|________|_______|
combo3 |true | false | true |true |
_________|______|________|________|_______|
combo4 |true | true | false |true |
_________|______|________|________|_______|
got the idea?
Now, develop logic that will set those "cells" to false as you click your combos.
In the beginning, all colors will be available to all controls - "true". Then you click one (any) combo. You reserve that control/color cell. Then you build your UI based on this matrix. With each click you have postback and your controls will be re-populated with available colors.
The best part - you will be able to have any number of controls or items for them. Once you run out of items or out of controls, you can't fill controls :o)

Resources