Function

BuildTemplateFields

Module

rTemplates

Last Modified

7/15/2014 3:26:44 PM

Comments

Simply builds XML fields on the server

Scope

Interfaced

Declaration

function BuildTemplateFields(XMLString: TStrings): boolean;

Calls Hierarchy


BuildTemplateFields
 └reset_broker

Called-By Hierarchy


                        BuildTemplateFields
TfrmTemplateEditor.mnuImportTemplateClick┘ 

Calls

Name Declaration Comments
reset_broker procedure reset_broker; -

Called-By

Name Declaration Comments
TfrmTemplateEditor.mnuImportTemplateClick procedure mnuImportTemplateClick(Sender: TObject); -


Source

403   function BuildTemplateFields(XMLString: TStrings): boolean;   //Simply builds XML fields on the server
404   var                                                           //in chunks.
405     i,j,p1: integer;
406     ok: boolean;
407   
408     procedure reset_broker;
409     begin
410       with RPCBrokerV do begin
411         ClearParameters := True;
412         RemoteProcedure := 'TIU FIELD LIST ADD';
413         Param[0].PType := list;
414       end;
415     end;
416   
417   begin
418     ok := TRUE;
419     with RPCBrokerV do
420     begin
421       reset_broker;
422       j := 1;
423       for i := 0 to XMLString.Count-1 do begin
424         p1 := pos('<FIELD NAME="',XMLString[i]);
425         if (p1 > 0) and (pos('">',copy(XMLString[i],p1+13,maxint)) > 0) then begin
426           j := j + 1;
427           if (j > 50) then begin
428             j := 1;
429             CallBroker;
430             if pos('1',Results[0]) = 0 then begin
431               ok := FALSE;
432               break;
433             end;//if
434             reset_broker;
435           end;//if
436         end;//if
437         Param[0].Mult[IntToStr(i+1)] := XMLString[i];
438       end;//for
439       if ok then begin
440         CallBroker;
441         if pos('1',Results[0]) = 0 then ok := FALSE;
442       end;//if
443     end;
444     Result := ok;
445   end;