Jump to content

bruno-pere

Members
  • Posts

    95
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by bruno-pere

  1. Sample to get report parameters if needed: http://msdn.microsoft.com/en-us/library/reportservice2005.reportingservice2005.getreportparameters.aspx And use FindItems to get a list of reports: http://msdn.microsoft.com/en-us/library/reportservice2005.reportingservice2005.finditems.aspx I didn't use in this project but works because I have used it in another project. As said, my project runs only one report in that function I shared and I pass the report name and parameters hard coded. Bye! Bruno
  2. Hi! Sorry for the delay. And I don't have time to make a sample and the procedure to Render the report is used for one of my reports only. If you want a generic procedure you should do changes like remove the two hardcoded parameters in the procedure. Test with a simple report first. 1) IMPORT CLASSES IN YOUR PROJECT (Delphi -> Menu Component -> Import WSDL) ReportExecution2005 (http://YOURSERVER/ReportServer/ReportExecution2005.asmx?wsdl) ReportService2010 (http://YOURSERVER/ReportServer/ReportService2010.asmx?wsdl) 2) DECLARE IN THE FORM YOU WILL CALL THE REPORT: procedure TYOURFORM.Rio1HTTPWebNode1BeforePost( const HTTPReqResp: THTTPReqResp; Data: Pointer); var user,pass: string; begin user := 'srv-test\administrador'; pass := 'yourpassword'; // the same account / password you use when using the browser to view the reports if not InternetSetOption(Data, INTERNET_OPTION_USERNAME, PChar(user), Length(user)) then ShowMessage(SysErrorMessage(GetLastError)); if not InternetSetOption(Data, INTERNET_OPTION_PASSWORD, PChar(pass), Length (pass)) then ShowMessage(SysErrorMessage(GetLastError)); end; // PARAMETERS DataEnt and CodComprador YOU SHOULD CHANGE FOR YOUR REPORT PARAMETER function TYOURFORM.RenderReport1(stm: TStream; const ExtFormat: string; DataEnt: TDateTime; CodComprador: integer):boolean; const ServiceURL = 'http://YOURSERVER/reportserver/ReportService2010.asmx'; // change for YOUR SERVER ExecURL = 'http://YOURSERVER/reportserver/ReportExecution2005.asmx'; var //rs: ReportService2010.ReportingService2010Soap; rsExec: ReportExecution2005.ReportExecutionServiceSoap; setParams: ReportExecution2005.SetExecutionParameters; setParamValues: ReportExecution2005.ArrayOfParameterValue; LRParams: ReportExecution2005.LoadReport; LoadParamsResponse: ReportExecution2005.LoadReportResponse; renderParams: ReportExecution2005.Render; renderResponse: ReportExecution2005.RenderResponse; setParamsResponse: ReportExecution2005.SetExecutionParametersResponse; execInfo: ReportExecution2005.ExecutionInfo; execHeader, renderHeader: ReportExecution2005.ExecutionHeader; I: integer; //args: array [0..4] of string; Rio1: THttpRio; begin result := false; LoadParamsResponse := nil; setParamsResponse := nil; Rio1 := THttpRIo.Create(nil); Rio1.HTTPWebNode.OnBeforePost := Rio1HTTPWebNode1BeforePost; Rio1.HTTPWebNode.UserName := 'extrafruti\administrador'; Rio1.HTTPWebNode.Password := 'yourpassword'; // the same account / password you use when using the browser to view the reports {Rio2.HTTPWebNode.UserName := 'srv-teste\administrador'; Rio2.HTTPWebNode.Password := '*****';} //rs := ReportService2010.GetReportingService2010Soap(False, ServiceURL, Rio2); rsExec := ReportExecution2005.GetReportExecutionServiceSoap(False, ExecURL, Rio1); execInfo := ReportExecution2005.ExecutionInfo.Create; execHeader := ReportExecution2005.ExecutionHeader.Create; LRParams := ReportExecution2005.LoadReport.Create; setParams := ReportExecution2005.SetExecutionParameters.Create; renderHeader := ReportExecution2005.ExecutionHeader.Create; renderResponse := ReportExecution2005.RenderResponse.Create; renderParams := ReportExecution2005.Render.Create; try try setlength(setParamValues,0); // Load the selected report. LRParams.Report := '/teste2'; // the report name in the root folder in this case LoadParamsResponse := rsExec.LoadReport(LRParams); // Send ExecutionHeader execHeader.ExecutionID := LoadParamsResponse.executionInfo.ExecutionID; Rio1.SOAPHeaders.Send(execHeader); // SET LENGTH EQUAL TO THE NUMBER OF PARAMETERS OF THE REPORT // AND PASS IN THE ARRAY LIKE I DID SetLength(setParamValues, 2); // parâmetro 1 (FIRST PARAMETER) setParamValues[0] := ReportExecution2005.ParameterValue.Create; setParamValues[0].Name_ := 'DATA_ENT'; setParamValues[0].Value := FormatDateTime('dd/MM/yyyy',DataEnt); // parâmetro 2 (SECOND PARAMETER) setParamValues[1] := ReportExecution2005.ParameterValue.Create; setParamValues[1].Name_ := 'COD_COMPRADOR'; setParamValues[1].Value := IntToStr(CodComprador); // change to your language setParams.ParameterLanguage := 'pt-BR'; setParams.parameters := setParamValues; setParamsResponse := rsExec.SetExecutionParameters(setParams); renderParams.Format := ExtFormat; // Send RenderHeader renderHeader.ExecutionID := LoadParamsResponse.executionInfo.ExecutionID; Rio1.SOAPHeaders.Send(renderHeader); renderResponse := rsExec.Render(renderParams); stm.Write(renderResponse.Result[0], Length(renderResponse.Result)); result := true; except on E: Exception do begin MessageDlg( 'Error creating report: ' + E.Message + #13#10 + 'Please contact.........', mtError, []); end; end; finally for I := Low(setParamValues) to High(setParamValues) do if setParamValues[I]<>nil then setParamValues[I].Free; if Assigned(setParamsResponse) then setParamsResponse.Free; if Assigned(renderResponse) then renderResponse.Free; if Assigned(renderParams) then renderParams.Free; if Assigned(execHeader) then execHeader.Free; if Assigned(execInfo) then execInfo.Free; if Assigned(LRParams) then LRParams.Free; Rio1 := nil; //RS := nil; RSExec := nil; // setParams.Free; end; end; 3) CALL LIKE THIS fname := 'c:\test.html'; // YOUR FILE NAME must be the same extesion you will pass stm := TMemoryStream.Create; try if RenderReport1(stm,'HTML4.0',UniDateEnt.DateTime,StrToInt(cp)) then // two parameters of my report UniSession.SendStream(stm,ExtractFileName(fname)); // you can mail the report too (SEE MY OTHER EXAMPLE IN UNIGUI FORUM) finally stm.Free; end; My uses: uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses, uniGUIClasses, uniGUIFrame, uniEdit, uniBasicGrid, uniDBGrid, uniSplitter, uniPanel, uniTrackBar, uniButton, uniBitBtn, uniMultiItem, uniComboBox, uniLabel, uniGUIBaseClasses, uniGroupBox, uniDateTimePicker, Data.DB, Data.Win.ADODB, uniDBComboBox, uniDBLookupComboBox, DateUtils, Datasnap.DBClient, SOAPHTTPTrans, WinINet, Soap.InvokeRegistry, Soap.Rio, Soap.SOAPHTTPClient, uniScreenMask, IdExplicitTLSClientServerBase, IdMessage; Please, share if you have success. It's working perfectly here. Bye! Bruno
  3. function FindFiles(searchstr: string; list: TStrings): boolean; var hn: THandle; fd: WIN32_FIND_DATA; begin Result := False; hn := FindFirstFile(PChar(searchstr),fd); if hn <> INVALID_HANDLE_VALUE then begin Result := True; list.Add(StrPas(fd.cFileName)); while FindNextFile(hn,fd) = True do list.Add(StrPas(fd.cFileName)); end; Windows.FindClose(hn); end; How to use: ComboBox.Items.Clear; FindFiles(folder+'*.jpg',ComboBox.Items); You can use any windows wildcards like: 'pr_uc_??????_.adt' Bruno
  4. You can separate modules in different isapi dlls and ports too. Bruno
  5. Hi! I posted a thread sample that is working fine in unigui. http://forums.unigui.com/index.php?/topic/2866-send-html-email-exchange-threaded-indy-1058/ Bruno
  6. Veja se ajuda... Compila com o gerenciador de memória FastMM e ativa a detecção de memory leaks através de uma diretiva de compilação que não lembro agora. http://delphibistro.com/?p=186 Já utilizei muito o FastMM quando o gerenciador de memória do Delphi era bem pior, agora está mais moderno. Tem AQTime e madExcept também, o mad eu já utilizei muito também para fazer hooks. Abs! Bruno
  7. I did a work around until the feature is done. Thx! Bruno
  8. Hi! Please join two features I posted in this feature only. UniDBGrid Immediate Editor http://forums.unigui.com/index.php?/topic/3305-unidbgrid-immediate-editor/ UniDBGrid Go to Next Record http://forums.unigui.com/index.php?/topic/3306-unidbgrid-goto-next-record/ What I suggest is an editing mode like excel, where a key pressed starts editing and while editing if the user press down or up the grid should post the current record and move to next or prior. If the user press left or right while editing the grid should move the cell. There are examples with this feature already implemented. http://www.sencha.com/forum/showthread.php?79861-walkCells%28%29-Problem-3.0.1 Thank you! Bruno
  9. Hi! I want to prevent navigation in the grid only after a record has been edited. In some situations on slow connections, a post in the grid can take a few seconds and I want to prevent the user from navigation the grid in that moment. I activated WebOptions.LoadMask. I activated WebOptions.knEnabled. When the user saves the record with a enter key, per example, the grid take few seconds to show "please wait" (loadmask), post and hide the message. In the time before "please wait" is showed, the user can navigate the grid. Then, when the grid returns focus after save, the position moved by the user is lost. The grid should not lose position or the grid should not allow navigation when saving. One or another. If the user moves the cursor using the mouse, the grid should not lose position. I tried using OnKeyDown and OnKeyPress ExtEvents and e.stopPropagation, e.stopEvent, e.cancel, e.preventDefautl, etc. and nothing works. To simulate slow connections I use the program speedlimit on my mac. There are other programs for windows. I need help. Thx! Bruno
  10. altagur, your way is very slow for the user to edit many records, like a hundred records a day per user. Bye! Bruno
  11. Hi! In UniDBGrid.ClientEvents.ExtEvents: function OnCellclick(sender, rowIndex, columnIndex, e) { var me = MainForm.UniDBGrid1; pos = me.getSelectionModel().getCurrentPosition(); //alert(pos.column); ajaxRequest(MainForm.UniDBGrid1, 'CellChanged', ['col='+pos.column,'row='+pos.row]); } function OnKeypress(e) { var me = MainForm.UniDBGrid1; pos = me.getSelectionModel().getCurrentPosition(); //alert(pos.column); ajaxRequest(MainForm.UniDBGrid1, 'CellChanged', ['col='+pos.column,'row='+pos.row, 'charcode='+e.getCharCode()]); } Then, in the OnAjaxEvent, an example procedure to get the row and col: procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TStrings); var col, row, fld, key, val: string; c, r: integer; begin if EventName='CellChanged' then begin col := Params.Values['col']; row := Params.Values['row']; key := Params.Values['charcode']; UniLabel2.Caption := key; if (UpperCase(col)<>'UNDEFINED')and(UpperCase(row)<>'UNDEFINED') then begin UniLabel1.Text := 'Col: ' + col + ', Row: ' + row; c := strtoint(col); r := strtoint(row); fld := UniDBGrid1.Columns[c].Field.FieldName; UniLabel1.Text := UniLabel1.Text + ' - ' + fld + ' - ' + ClientDataset1.FieldByName(fld).AsString; end; end end; Bye! Bruno
  12. Hi! When editing a cell, if the user press DOWN or UP, the grid should post the current record and go to next or prior record. Bye! Bruno
  13. Hi! Start cell edit mode when the user press a key. http://forums.unigui.com/index.php?/topic/2706-tunidbgrid-is-it-possible-to-start-cell-editing-when-key-pressed/?hl=press This would be a nice feature. Bruno
  14. Farshad, Can you tell me what are the uniCellEditor methods and properties? I know there is startEditByPosition because I'm using it. Thx! Bruno
  15. In every form? Thx! Bruno
  16. Hi! I can not get the grid to show numeric fields localized. Brazil uses comma as decimal and dot as thousand but the grid always show the inverse. What's the correct method to change this? Delphi XE2 UniGUI 0.93.0.996 ExtJS 4.2.1.744 If I can not solve the problem I'll open a case. Thx! Bruno
  17. Para desenvolvimento utilize standalone. Fica muito mais rápido o start/stop da aplicação.
  18. Any news on this? Bruno
  19. Thank you! Solved here too. function OnCellclick(sender, rowIndex, columnIndex, e) { var me = MainForm.UniDBGrid1; pos = me.getSelectionModel().getCurrentPosition(); //alert(pos.column); ajaxRequest(MainForm.UniDBGrid1, 'CellChanged', ['col='+pos.column,'row='+pos.row]); } function OnKeypress(e) { var me = MainForm.UniDBGrid1; pos = me.getSelectionModel().getCurrentPosition(); //alert(pos.column); ajaxRequest(MainForm.UniDBGrid1, 'CellChanged', ['col='+pos.column,'row='+pos.row]); } OnAjaxEvent var col, row: string; begin if EventName='CellChanged' then begin col := Params.Values['col']; row := Params.Values['row']; if (UpperCase(col)<>'UNDEFINED')and(UpperCase(row)<>'UNDEFINED') then begin UniLabel1.Text := 'Col: ' + col + ', Row: ' + row; end; end;
  20. Hi! I need to get the row and col when the user selects a new cell in the grid. The user can change using mouse or keyboard. Anyone know how to get this? I tried using OnCellClick but it fires only when the user clicks the mouse. I need to get after using the keyboard too. Thank you! Bruno
  21. Bruno, Espirito Santo.
×
×
  • Create New...