<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://frp.sage.fr/wiki1000/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
		<id>https://frp.sage.fr/wiki1000/index.php?action=history&amp;feed=atom&amp;title=UpdateFrom_%28selector%29</id>
		<title>UpdateFrom (selector) - Historique des versions</title>
		<link rel="self" type="application/atom+xml" href="https://frp.sage.fr/wiki1000/index.php?action=history&amp;feed=atom&amp;title=UpdateFrom_%28selector%29"/>
		<link rel="alternate" type="text/html" href="https://frp.sage.fr/wiki1000/index.php?title=UpdateFrom_(selector)&amp;action=history"/>
		<updated>2026-05-30T19:32:04Z</updated>
		<subtitle>Historique pour cette page sur le wiki</subtitle>
		<generator>MediaWiki 1.18.6</generator>

	<entry>
		<id>https://frp.sage.fr/wiki1000/index.php?title=UpdateFrom_(selector)&amp;diff=14809&amp;oldid=prev</id>
		<title>Syfre le 23 décembre 2025 à 08:06</title>
		<link rel="alternate" type="text/html" href="https://frp.sage.fr/wiki1000/index.php?title=UpdateFrom_(selector)&amp;diff=14809&amp;oldid=prev"/>
				<updated>2025-12-23T08:06:13Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Version précédente&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Version du 23 décembre 2025 à 08:06&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ligne 21 :&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ligne 21 :&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;|iUpdatePropValues&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;|iUpdatePropValues&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;|Tableau de &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;valeur &lt;/del&gt;pour les attributs mis à jour&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;|Tableau de &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;valeurs &lt;/ins&gt;pour les attributs mis à jour&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;|}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;|}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Syfre</name></author>	</entry>

	<entry>
		<id>https://frp.sage.fr/wiki1000/index.php?title=UpdateFrom_(selector)&amp;diff=14806&amp;oldid=prev</id>
		<title>Syfre : Page créée avec « &lt;source lang='delphi'&gt;function UpdateFrom(iSelector:TSelector; const iMatchedProps:Array of String; const iUpdatePropNames:Array of string; const iUpdatePropValues:Array o... »</title>
		<link rel="alternate" type="text/html" href="https://frp.sage.fr/wiki1000/index.php?title=UpdateFrom_(selector)&amp;diff=14806&amp;oldid=prev"/>
				<updated>2025-12-23T08:04:57Z</updated>
		
		<summary type="html">&lt;p&gt;Page créée avec « &amp;lt;source lang=&amp;#039;delphi&amp;#039;&amp;gt;function UpdateFrom(iSelector:TSelector; const iMatchedProps:Array of String; const iUpdatePropNames:Array of string; const iUpdatePropValues:Array o... »&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang='delphi'&amp;gt;function UpdateFrom(iSelector:TSelector; const iMatchedProps:Array of String; const iUpdatePropNames:Array of string; const iUpdatePropValues:Array of variant):Integer;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cette méthode met à jour les objets sélectionnés par le sélecteur en utilisant un sélecteur source&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Paramètre&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|Result&lt;br /&gt;
|Nombre d'objets affectés par l'opération&lt;br /&gt;
|-&lt;br /&gt;
|iSelector&lt;br /&gt;
|Sélecteur source &lt;br /&gt;
|-&lt;br /&gt;
|iMatchedProps&lt;br /&gt;
|Tableau de noms d'attribut qui doivent être égaux entre les deux sélecteurs&lt;br /&gt;
|-&lt;br /&gt;
|iUpdatePropNames&lt;br /&gt;
|Tableau de noms d'attribut devant être mis à jour dans la même opération&lt;br /&gt;
|-&lt;br /&gt;
|iUpdatePropValues&lt;br /&gt;
|Tableau de valeur pour les attributs mis à jour&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Cette fonction retourne le nombre d'objets affectés par l'opération.&lt;br /&gt;
&lt;br /&gt;
* iSelector&lt;br /&gt;
:Sélecteur source de l'opération, doit être en mode CTE&lt;br /&gt;
&lt;br /&gt;
* iMatchedProps&lt;br /&gt;
:Tableau de propriétés qui doivent matcher dans l'opération de mise à jour CTE&lt;br /&gt;
&lt;br /&gt;
* iUpdatePropnames,iUpdatePropValues&lt;br /&gt;
:Ces deux tableaux doivent avoir le même nombre d'élément et doivent référencer des attributs de la classe du sélecteur&lt;br /&gt;
&lt;br /&gt;
{{tip|L'opération est effectué par un ordre SQL en mode auto commit, si une transaction longue est ouverte la session de la transaction longue est utilisée.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MERGE target AS tm1 &lt;br /&gt;
USING (source) AS tm0 ON ( tm0 matched properties tm1) &lt;br /&gt;
WHEN MATCHED THEN UPDATE&lt;br /&gt;
 tm1.iUpdatePropNames = tm0.iUpdateSourceValues&lt;br /&gt;
;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Exemple :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang='delphi'&amp;gt;&lt;br /&gt;
//function _MAJPieceEtatPieceTypeAucun(aDateLimiteTraitement:datetime):integer;&lt;br /&gt;
Type&lt;br /&gt;
  vuePieceTypeAucun = viewOf(TEcheance)&lt;br /&gt;
    idPiece : TOID = Ecriture.oidPiece;&lt;br /&gt;
    idLettrage : TOID = oidLettrage notInSelect;&lt;br /&gt;
    typeEcheance : integer = Ecriture.Piece.TypePiece.typeEcheance notInSelect;&lt;br /&gt;
    [typeEcheance=TypeEcheance_Aucun]&lt;br /&gt;
  end;&lt;br /&gt;
&lt;br /&gt;
  vueEcheanceAvecPieceTypeAucun = viewOf(TEcheance)&lt;br /&gt;
    oidpieceEtat : TOID = oidPieceEtat;&lt;br /&gt;
    typeEcheance : integer = Ecriture.Piece.TypePiece.typeEcheance notInSelect;&lt;br /&gt;
    estLettrageTotal : boolean = Lettrage.LettrageEcriture.total notInSelect;&lt;br /&gt;
    dateLettrage : datetime = Lettrage.LettrageEcriture.lDate notInSelect;&lt;br /&gt;
    cNature:integer = Ecriture.CompteGeneral.natureCompte notInSelect;&lt;br /&gt;
    //&lt;br /&gt;
    idPieceDestination : TOID = vuePieceTypeAucun.select('idPiece','(idLettrage=self.oidLettrage)','-Ecriture.eDate,-dateEcheance,-oid',true,[]);&lt;br /&gt;
    aExistePieceDestination : TOID = vuePieceTypeAucun.select('idPiece','(idLettrage=self.oidLettrage)','',true,[]) notInSelect;&lt;br /&gt;
&lt;br /&gt;
    [(typeEcheance in (TypeEcheance_Facture, TypeEcheance_FactureTVA, TypeEcheance_Reprise)) and&lt;br /&gt;
    (cNature=NatureCompte_TTC) and (((estLettrageTotal=true) and (dateLettrage&amp;gt;=%ArgDateLettrage)) or (estLettrageTotal=false)) and&lt;br /&gt;
    (oidPieceEtat='') and (Lettrage.oidEcritureDestination='') and (aExistePieceDestination&amp;lt;&amp;gt;'')]&lt;br /&gt;
  end;&lt;br /&gt;
&lt;br /&gt;
  vueEcheance = viewOf(TEcheance)&lt;br /&gt;
    oidpieceEtat : TOID = oidPieceEtat;&lt;br /&gt;
  end;&lt;br /&gt;
var&lt;br /&gt;
  vSel, vSelUpdate : TSelector;&lt;br /&gt;
  vBatchCount : integer;&lt;br /&gt;
begin&lt;br /&gt;
  Result := 0;&lt;br /&gt;
  // Mise à jour de la pièce état des échéances Facture/Facture TVA/Reprise des deux derniers exercices&lt;br /&gt;
  // La pièce état est la pièce la plus récente de type &amp;quot;Aucun&amp;quot; du groupe de lettrage&lt;br /&gt;
&lt;br /&gt;
  vBatchCount := 0;&lt;br /&gt;
  Repeat&lt;br /&gt;
    // Source selector of the CTE operation&lt;br /&gt;
    // (MUST BE CTE)&lt;br /&gt;
    //&lt;br /&gt;
    vSel := vueEcheanceAvecPieceTypeAucun.CreateSelector('', '', true, []);&lt;br /&gt;
    vSel.AddParameter('ArgDateLettrage', aDateLimiteTraitement);&lt;br /&gt;
    vSel.MaxInstances := nbElementParLot;&lt;br /&gt;
    vSel.useCTE := true;&lt;br /&gt;
&lt;br /&gt;
    // ON match TEcheance on &amp;quot;oid&amp;quot; THEN update &amp;quot;oidpieceEtat&amp;quot; of dest FROM &amp;quot;idPieceDestination&amp;quot; of source&lt;br /&gt;
    //&lt;br /&gt;
    vSelUpdate := vueEcheance.CreateSelector('', '', true, []);&lt;br /&gt;
    vBatchCount := vSelUpdate.UpdateFrom(vSel, ['oid'], ['oidpieceEtat'], ['idPieceDestination']);&lt;br /&gt;
    Result := Result + vBatchCount;&lt;br /&gt;
  Until (vBatchCount&amp;lt;nbElementParLot);&lt;br /&gt;
end;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Voir aussi :&lt;br /&gt;
&lt;br /&gt;
* [[Update (selector)|Update]]&lt;br /&gt;
&lt;br /&gt;
{{Footer|Selecteur (tech)}}&lt;br /&gt;
[[category:Sélecteur]]&lt;/div&gt;</summary>
		<author><name>Syfre</name></author>	</entry>

	</feed>