|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
- Function SG_ExecQuery() Returns boolean;
- Local string &sOutFile;
- Local Record &rcdQryRunParms;
- Local Record &rcdQryPrompts;
- Local SQL &sqlSelectQryParms;
- Local number &cnt, &i, &Result;
- Local ApiObject &aQry, &QryRunTimePrompts;
- Local boolean &bPublic;
- Local number &nOrigPSMessagesMode;
- Local ApiObject &PSMessages;
- Local number &MsgSetNbr, &MsgNbr;
- Local boolean &bResult;
- &nOrigPSMessagesMode = %Session.PSMessagesMode;
- %Session.PSMessagesMode = 1;
- &sQryName = "Your Query Name";
- &sOutFile = %FilePath | &sQryName | "_" | SG_VNDR_DEB_AET.PROCESS_INSTANCE;
- &aQry = %Session.GetQuery();
- If &aQry.Open(&sQryName, True, False) = 0 Then
- &rcdQryPrompts = &aQry.PromptRecord;
- If &rcdQryPrompts <> Null Then
- &QryRunTimePrompts = &aQry.RunTimePrompts;
- &rcdQryRunParms = CreateRecord(Record.SG_RUN_VNDRDBTS);
- &sqlSelectQryParms = CreateSQL("%Selectall(:1) WHERE OPRID = :2 AND RUN_CNTL_ID = :3");
- &sqlSelectQryParms.Execute(&rcdQryRunParms, %OperatorId, SG_VNDR_DEB_AET.RUN_CNTL_ID);
- While &sqlSelectQryParms.Fetch(&rcdQryRunParms)
- &rcdQryPrompts.GetField(Field.OPRID).Value = &rcdQryRunParms.GetField(Field.OPRID).Value;
- &rcdQryPrompts.GetField(Field.RUN_CNTL_ID).Value = &rcdQryRunParms.GetField(Field.RUN_CNTL_ID).Value;
- Break;
- End-While;
- &sqlSelectQryParms.Close();
- End-If;
- &Result = &aQry.RunToFile(&rcdQryPrompts, &sOutFile, %Query_XLS, 0);
- End-If;
- &aQry.Close();
- %Session.PSMessagesMode = &nOrigPSMessagesMode;
- If %Session.PSmessages.Count = 0 Then
- Return True;
- Else
- &bResult = True;
- &PSMessages = %Session.PSmessages;
- For &i = 1 To &PSMessages.Count
- If (&PSMessages.Item(&i).MessageType <= 1) Then
- &bResult = False;
- Break;
- End-If;
- End-For;
- Return &bResult;
- End-If;
- End-Function; /* SG_ExecQuery */
- If SG_ExecQuery() = True Then
- Exit (0);
- Else
- Exit (1);
- End-If;
|
|
|