ONYX - 9.0 - Usage

ONYX Designer Advanced features

De MappingDoc
Révision datée du 26 juillet 2019 à 14:03 par Alestoquoi (discussion | contributions) (Page créée avec « When using the "'''-Generate'''" setting (indicating a project generation), the "'''-ProjectFile :'''" or "'''-ProjectAsso :'''" setting must be present to identify the pr... »)
Autres langues :
English • ‎français

Advanced features

Barcodes

Creating barcodes

To create a barcode in Designer, create a zone type Barcode and select the barcode sub-type you want.

Types of barcodes

  • EAN 8 This barcode is used to track logistics units and identify stock keeping units. The eight characters version is used for small sized packages. The data must contain seven digits. The eighth character is a check digit which is calculated by the computer.
  • EAN 13 This barcode is used to track logistics units and identify stock keeping units. In an EAN 13 code, the first two characters are the identifiers of the country of origin, the other 10 are the data and the last is the check digit which is calculated by the computer. The data must contain 12 digits.
  • Code 39

    This barcode is used to encode alphanumeric data. It is used in almost every industry except the retail sector. The data may be of variable length and may contain letters and digits.

    The information can be of any length and contain digits, uppercase letters and the "space", "plus sign", "minus sign", "division", "dot", "percentage" and "dollar" characters.

  • Code 128 allows general alphanumerical data and ASCII data to be encoded. These codebars are used in numerous industries for stock management purposes. The data is of variable length. The Code 128 C must contain an even number of characters (otherwise a zero is added at the beginning of the barcode) and may only contain digits. The Code 128 B accepts all ASCII characters, whereas the Code 128 A accepts only some of them. The information to encode can be of any length and composed of:
    • Optimised: digits, uppercase letters, lowercase letters, printing or non-printing ASCII characters (0 - 128), and all the function signs and characters provided by the Code 128 in the A, B and C code sets, with systematic length optimisation
    • N/optimised: digits, uppercase letters, lowercase letters, printing or non-printing ASCII characters (0 - 128), and all the function signs and characters provided by the Code 128 in the B code set, without length optimisation
    • Digital: digits and check character provided by the Code 128 in the C code set, with systematic length optimisation
  • Code 2/5 interleaved This encoding of numbers is used to enter information about the density of products, in response to precise specifications. The security of this symbology is weak, except when using optional security measures (check character, messages of fixed length that are checked when scanning).
    • Although the length of the barcode is unlimited in terms of the number of characters, the principle of interleaving requires the following:
    • An even number of digits when the optional check character is not used
    • An odd number of digits when the optional check character is used
  • Code 2/5 industrial This old symbology was frequently used in industry, particularly the automotive industry. The security of this symbology is weak, unless it is used with messages of fixed-length and checked when scanning.

The data must contain 1 to 32 digits

    • Digital information encoding that is designed for its ease of use
    • Development or modification of pre-existing applications
  • EAN128 Alpha n/optimised Code GS1-128 Used to identify dispatch units (pallets or cartons, possibly).
    • Encoding of alphanumeric information,
    • Variable length,
    • Continuous bidirectional self-checking.
  • EAN128 digital Code GS1-128 Used to identify dispatch units (pallets or cartons, possibly)..
    • Encoding of digital information,
    • Variable length,
    • Continuous bidirectional self-checking.
  • PDF 417 Used in every sector of activity. The PDF417 code is the only two-dimensional barcode that can be scanned using a simple linear scan (1D) due to the fact that, as stacked linear symbology, it has the features of linear barcodes as well as those of two-dimensional ones.
    • Two-dimensional,
    • Alphanumeric 2000 length,
    • Eight levels of security.
  • Data Matrix This code can encode up to 2335 characters. Various types of encoding are available (ASCII, C40, text and Base 256). The default mode is the automatic mode which can be used to optimise the encoding by swapping from one mode to the other depending on the data. It also has an error detection/correction system to repair any damage.
  • Postnet The Postnet barcode is used by the United States postal service. It has been replaced by the USPS or Intelligent Mail barcode.
  • Planet The Planet barcode is used by the United States postal service. It has been replaced by the USPS or Intelligent Mail barcode.
  • QR Code It has the particular feature of being able to encode a very large number of characters (7336 in numeric mode). This type of barcode is very widespread in Japan. There are four types of encoding (alphanumeric, numeric, bytes, Kanji) for compressing the data by varying degrees depending on the type of data. By default, an automatic mode is used to choose the encoding method that will give the best compression rate (switch of mode while processing). Error detection/correction codes are added to the data, which are used to prevent the loss of data in the event of damage. There are four levels of error detection/correction.
  • MaxiCode The MaxiCode barcodes, developed by UPS - United Parcel Service, are defined by the ISO 16023-2000 standard. Unlike the others, it has a set size, which limits the number of characters to be encoded. Indeed, the maximum number of characters is 93 alphanumeric characters or 138 numeric characters. There are two types of encoding. The first only encodes a string of characters containing data according to a conventional type of encoding and a standard type of error detection/correction. The second type encodes the following three fields in addition to the string of data: the country which is encoded using 3 digits according to the ISO 3166 standard, the postal code which is encoded using 6 characters and finally a type of service using 3 digits. These three fields are encoded using an extended error correction mode contrary to the string of data whose correction mode is standard.
  • Japan Postal The Japan Postal barcode is used by the Japanese postal service.
  • Codabar (NW7) In Japan, the Codabar Monarch is also called NW-7. The relatively simple composition of the Codabar Monarch means that it is frequently used to encode serial numbers for applications involving blood bank transfusion services, home deliveries, libraries, etc.
  • USPS USPS = United States Postal Service. The more commonly used official name is the Intelligent Mail Barcode. It is the new American postal barcode, which is to replace the Planet and the Postnet. The Intelligent Mail barcode is a 4-state barcode composed of 65 bars.
  • UPC-A The UPC-A barcode est un équivalent américain du code à barres EAN13, dont le premier chiffre serait 0. is a U.S. equivalent of the EAN13 barcode, the first digit of which is 0. It is used primarily to identify products in store. The UPC-A barcode can encode 11 digits, a number system, five digits for the Manufacturing Code and five digits for the product code. A 12th digit is calculated using the first eleven in order to act as a check digit.
  • UPC-E The UPC-E barcode is a short version of the UPC-A barcode, in which the ten digits of the UPC-A barcode (manufacturing and product code) are reduced to six digits by removing superfluous zeros. With the Number System and the check digit, a UPC-E barcode is therefore composed of eight digits. M-Designer can be used to include UPC-A (11 digits) barcodes in the UPC-E format as well as a code reduced to 6, 7 or 8 digits.
  • MSI The MSI barcode is used primarily for stock management, marking storage containers and shelving in warehouse environments. An MSI barcode uses one or two check keys calculated using the Modulo 10 or Modulo 11 methods and is used to encode numeric values of indefinite size. Designer can encode using either a Modulo 10 check key, a Modulo 11 check key, two Modulo 10 check keys, or even a Modulo 11 check key followed by a Modulo 10 check key.

The size of the barcode

The size of the barcode can be defined in the following two ways:

  • The first involves choosing the Fit the area option in the Properties view, lin which case the barcode will adjust as well as possible to the size of the zone, according to its standard
  • If the Fit the area option is unticked, the size of the barcode can be set by the size of the font of the zone. This size affects the width and the height of the code. The height can be reduced by reducing the percentage of the height setting of the zone.

Combined data

It is possible to combine data found in different places in the spooled file within a single barcode. In order to achieve this, it is necessary to create as many memory zones as there are elements of data to be retrieved from the spooled file and then all these zones must be combined in the label of the barcode zone.

  • In the Map F tab:

cid:image002.png@01D170A6.CBD745A0

  • In the Properties view:

cid:image003.png@01D170A6.CBD745A0

  • In this example, the Memory zone have the values:
    • MEM_FACT : 0012601
    • MEM_DTFACT : 14/10/99
  • Outcome:

cid:image004.png@01D170A7.20EEB820

It is also possible to add text that is not found in the spooled file using the Memory zones (detailed in 6.4.a.3 Types of zones) : [[MEM1]]TEXT[[MEM2]].

If you use replacement zones in a Barcode zone, the length of the barcode must be equal to 0.

Special case: EAN128

The encoding of the EAN128 is identical to the encoding of the Code128. That is why we use the same fonts. The difference is that the EAN128 is structured in order to standardize the information that it contains. To achieve this, an AI (Application Identify) is inserted between each piece of information, which is used to identify the data encoded.

Structure of the EAN128: START FNC1 AI DATA (FNC1) AI DATA .... (FNC1) AI DATA CRC END

FNC1: Separator character of the EAN128.

AI: Application Identifier, is used to encode several standardized elements of information in one code (date+time+etc.).

The first FNC1 is automatically added by M-Designer. It is required as it is used to differentiate an EAN128 barcode from a CODE128 barcode.

However, the following FNC1 are optional. Indeed, they are only required when the previous element of data does not have a fixed length, in which case they are used to separate each element of data.

If you want to insert the FNC1 character, you have to put the {FNC1} character sequence in your spooled file. These characters will automatically be replaced with FCN1 characters by MAPPING.

Ex: SPOOL ----> MAPPING

AI DATA ----> START FNC1 AI DATA CRC END

AI DATA {FNC1} AI DATA ----> START FNC1 AI DATA FNC1 AI DATA CRC END

If you cannot change your spool to add the "{FNC1}" characters or if you want to combine several elements of data that are located in different places in the spooled file (see previous paragraph: 8.1.b. Combined data), you can use the memory zones.

Special case: code 128

There are three encoding modes for 128 barcodes:

  • mode A (alphanumerical),
  • mode B (alphanumerical). The code 128 Alphanumeric encodes in B mode,
  • mode C (numerical). The code 128 Alphanumeric encodes in C mode.

The code 128 Alphanumeric Optimized switches from B mode to C mode automatically in order to optimize the size of the barcode.

However, your barcode may have to comply with a specific type of formatting, i.e. a certain number of characters in A, B or C mode.

For example, the barcode that corresponds to the mail tracking ID of "La Poste" contains 13 characters. The first three must be encoded in B mode and the last ten in C mode.

In order to create this barcode using Designer, you must create a "Code 128 N/Optimisé" type zone and then enter a formatting screen in the Advanced options of the zone.

Example:

For the following data: 1J45034500751

You want to encode:

- the first three characters (1J4) in B mode

- the last ten characters (5034500751) in C mode

Your formatting mask must therefore be BBBCCCCC.

You will notice that although there are ten digits to be encoded in C mode, there are only five 'C's in the formatting mask. This is due to the fact that one character in C mode encodes two digits.

Special case: 2D Codebars

Currently, MAPPING manages four types of 2D barcode: PDF417, DATA MATRIX, QR CODE and MAXICODE.

If "Fit the area" is checked, the "Barcode width" setting is used to change the size of the barcode. In this case it should be noted that the size of the barcodes can vary in height and width depending on the content to be encoded.

The benefit of 2D barcodes is being able to encode a number of important pieces of information. If the data that you need to encode is located in different places in the spool, go to section 8.1.b. Combined data to combine them in a single barcode.

QR code

The QR CODE barcode was developed according to the International ISO/IEC 18004 standard. It has the particular feature of being able to encode a very large number of characters (7336 in numeric mode).

This type of barcode is very widespread in Japan. It is already used in the industry, but has also been adopted by the general public eversince mobile phones know how to decode it.

There are four types of encoding (alphanumeric, numeric, bytes, Kanji) for compressing the data by varying degrees depending on the type of data. By default, the automatic mode is used to choose the encoding method that will give the best compression rate (switch of mode while processing). For example, let us assume that the beginning of the string contains alphanumeric type data. As soon as the program detects a string of at least 13 numeric characters, it changes encoding mode.

Error detection/correction codes are added to the data. These codes prevent losing data through damage. There are four levels of error detection/correction. By default, level three is used, whose codes use approximately 25% of the final barcode.

Onyxdesigner-image75.png

Advanced options available:

  • Barcode width: Value between 1 and 15 specifying the size of the barcode.
  • Error Level: (7%, 15%, 25% and 30%).
  • FCN1:
    • ECI protocol not implemented.
    • ECI protocol not implemented, FNC1 implied in first position.
    • ECI protocol not implemented, FNC1 implied in second position n the last case, a separator character (Application identifier) must be specified.
  • Application Identifie: Separator character, used only with the implicit FCN1 in second position.
  • Type of encoding:
    • AUTO: Automatic encoding of the data with a mode change depending on the data.
    • ALPHA: Alphanumeric encoding.
    • NUMERIC: Numerical encoding.
    • BYTE: Encoding in bytes.

DATAMATRIX

The Datamatrix barcode is defined by the International ISO/IEC 16022 (ECC200) standard. This code can encode up to 2335 characters.

Various types of encoding are available (ASCII, C40, text and Base 256) and the default mode is the automatic mode that can be used to optimize the encoding by swapping from one mode to the other depending on the data.

It also has an error detection/correction system to repair any damage.

Onyxdesigner-image76.png

Advanced options:

  • Barcode width: Value between 1 and 15 specifying the size of the barcode.
  • Type of encoding :
    • AUTO: Automatic encoding of the data with a mode change depending on the data
    • ASCII: The ASCII encoding is a tacit plan for encoding the ASCII data.
    • C40: C40 encoding transforms 3 alphanumeric characters into two code words.
    • TEXT: The Text encoding is used to encode the lowercase characters.

PDF 417

The PDF 417 is defined by the International ISO/IEC 15438 standard. This type of barcode can encode up to 2700 numeric characters.

There are three types of data encoding (alphanumeric, numeric and bytes). The automatic mode chooses the best compression rate and changes the mode while encoding.

There are also eight levels of error detection/correction mode. In automatic mode, the level is chosen according to the number of characters to be encoded.

Onyxdesigner-image77.png

Advanced options:

  • Barcode width: Value between 1 and 15 specifying the size of the barcode
  • Error Level:
    • AUTO: choix automatique.
    • 0 - 8
  • Compact mode: Activation of the compact mode or not.
  • Ratio: Used to determine the height/width ratio of the barcode.
  • Fixed columns: Used to define the number of columns.
  • Fixed rows: Used to define the number of rows.

The selection of a ratio prevents you from specifying the number of rows and columns.

UPS MAXICODE

This type of barcode, developed by UPS - United Parcel Service, is defined by the ISO 16023-2000 standard. Unlike the others, it has a set size, which limits the number of characters to be encoded. Indeed, the maximum number of characters is 93 alphanumeric characters or 138 numeric characters.

There are two types of encoding:

  • The first only encodes a string of characters containing data according to a conventional type of encoding and a standard type of error detection/correction.
  • The second type encodes three other fields stored in three of Designer's memory spaces, in addition to the string of data. These fields are: the country encoded using 3 digits in accordance with the ISO 3166 standard (called MAP_countr), the postal code encoded using 6 characters (MAP_zipcod) and finally a type of service using 3 digits (MAP_servic). These three fields are encoded using an extended error correction mode contrary to the string of data whose correction mode is standard.

Onyxdesigner-image78.png

Advanced options available:

  • Barcode width: Value between 1 and 15 specifying the size of the barcode.

Automating

Automating Designer processes allows you to create image files corresponding to the preview of a project as well as generate a project or an association of projects. All this can be done in order line, in hidden mode or not.

The principle is to build the order with a .BAT or a remote order, for example.

  • -InFile: .PAG or .XML file to map.
  • -OutFile: Output image file.
  • -ProjectFile: Projet to open (.MPP).
  • -ProjectAsso: Project association to generate (.MPA).
  • -MPIFile: .MPI file to open (MAP tab).
  • -MPWFile: .MPW file to open (DRAW tab).
  • -Hide: To launch Designer in hidden mode.
  • -Color: Use of colour or not to create the image.
  • -Rotation: rotation angle of the image (default: 0).
  • -Resolution: Image resolution (default: 300).
  • -Specimen: Adding a text above the image (text to specify in the argument).
  • -Mode: Choice of the SPOOLED FILE or XML mode (default SPOOLED FILE).
  • -Generate: To start generating the project indicated in the argument.
  • -FtpUse: 0 = does not use FTP; 1 = uses FTP.
  • -FtpFolder: FTP folder.
  • -FtpLogin: FTP login.
  • -FtpPassword: FTP password.
  • '-FtpIPAddress: IP address of the server.
  • -ShareFolder: Shared folder.
  • -ServerName: Name of the server (description).
  • -Rename: changes the FORMAT and SEQUENCE of the project using its name. Ex: Invoice00010.mpp.

Example 1: Project generated in PCL, in color and 300 dpi

C:\Mapping\M-Designer\M-Designer.exe "-Hide" "-ProjectFile:C:\Mapping\M-Processing_Server \Import\docpc\test.mpp" "-Generate"

When using the "-Generate" setting (indicating a project generation), the "-ProjectFile :" or "-ProjectAsso :" setting must be present to identify the project as to be generated.

Si les deux paramètres « -ProjectFile : » et « -ProjectAsso : » sont présents, le projet sera prioritaire pour la génération et l’association de projets sera ignorée.

Exemple 2 : création d’une image BMP couleur, avec rotation de 90°, en 203 dpi et avec l’inscription SPECIMEN par-dessus

C:\Mapping\M-Designer\M-Designer.exe "-InFile:c:\test.xml" "- OutFile:c:\image.bmp" "-ProjectFile:C:\ Mapping\M-Processing_Server \Import\docpc\test.mpp" "-Hide" "-Rotation:90" "- Resolution:203" “-Color” "-Mode:XML" "-Specimen:SPECIMEN"

Pour la création d’une image, les paramètres « -InFile » et « -ProjectFile » sont obligatoires.

Si « -OutFile » est absent, le fichier de sortie prend le nom du fichier d’entrée avec l’extension .BMP.

Le mode par défaut est SPOOL et si le fichier d’entrée est de type XML, vous devez préciser le mode.

Attention : Les guillemets autour de chaque paramètre sont obligatoires.

Remplacement de caractère

L'objectif est d'expliquer comment remplacer une chaîne de caractères du fichier d'entrée par une autre.

Le principe de fonctionnement est l'utilisation d'un fichier texte comme table de correspondance entre la valeur à remplacer et la nouvelle valeur.

Pour utiliser cette table de correspondance, il faut :

  • Définir la zone en mode Type = Texte / Sous-type = Substitution.

Onyxdesigner-image79.png

  • Terminer et générer la maquette
  • Ouvrir le fichier ReplaceValue.txt dans un éditeur de texte (type Notepad mais pas Word). La syntaxe du fichier est la suivante :

Valeur à remplacer Tabulation Nouvelle valeur

Onyxdesigner-image80.png

Ici, le caractère "]" sera remplacé par le caractère ">" et le "Nom" sera remplacé par "Name" (si la valeur à remplacer se trouve dans une zone de Type Texte \ Substitution).

  • Sauvegarder le fichier ReplaceValue.txt dans le sous-répertoire lgobitmap de Mapping (par défaut /apps/mapping/import/lgobitmap sur Unix)

Dessiner un tableau

Dessiner un tableau statique

Pour obtenir un tableau parfaitement dessiné et aligné, sans utiliser l'outil Tableau Statique de la vue Fond de page, les étapes à suivre sont :

  • tracer d’abord le rectangle du contour du tableau,
  • tracer des lignes verticales pour définir les colonnes,
  • tracer éventuellement des traits horizontaux pour définir les lignes si besoin (entêtes de colonnes par exemple),
  • sélectionner enfin l’ensemble des éléments du tableau puis appuyer sur la touche « a » minuscule du clavier :

Onyxdesigner-image83.png

Onyxdesigner-image84.png

Remarque :

Cette aide à la conception est opérationnelle en vue Fond de page et vue Dynamique du projet. En vue Dynamique, il est possible de tracer un tableau à l'intérieur d'un Groupe et de placer, par exemple, une condition d'exécution sur une ligne horizontale pour tracer dynamiquement un trait pour chaque nouvelle ligne de données.

Dessiner un tableau dynamique

Comme annoncé dans les options disponibles pour un groupe (cf. paragraphe 6.4.b.2. Créer un groupe fixe), le mode Tableau permet aux zones du groupe de se comporter comme les cellules d’un tableau. Les zones d’une même ligne se retrouvent donc automatiquement collées.

Remarque :

Redimensionner ou déplacer une zone impacte la taille et le positionnement des zones adjacentes.

Les lignes du groupe (ou conditions) sont visuellement représentées dans la fenêtre de conception. Les zones sont, quant à elles, réparties verticalement en fonction de leur ligne.

Onyxdesigner-image85.png

Construction d’un graphique

Depuis la partie Map :

  • Créer un graphique depuis l’onglet Graphique :

Onyxdesigner-image86.png

  • Et lui donner un nom (ici « GRAPH1 ») :

Onyxdesigner-image87.png

A partir de là, le graphique complexe peut se construire de deux façons différentes présentées ci-dessous.

Par sélection des zones une à une

  • Sélectionner, dans le spool, les zones qui seront utilisées dans le graphique,
  • Dans les Propriétés, pour chaque zone définie :
    • Les nommer toutes avec le même nom que le graphique (ici ça sera donc « GRAPH1 »)
    • Renseigner le Type = « Graphique » :

Onyxdesigner-image88.png

  • Selon l’utilité de la zone dans le graphique, sélectionner le Sous-type correspondant dans la liste proposée :

Onyxdesigner-image89.png

  • Aller dans les Propriétés du graphique et cliquer sur Edition :

Onyxdesigner-image90.png

  • Paramétrer votre graphique en choisissant dans les onglets :
    • Type :
      • Nom du Graphique : qui sera repris dans le nom des zones,
      • Nombre de zones qui va composer le graphique,
      • Type de graphique : Camembert, Histogramme ou Ligne :

Onyxdesigner-image91.png

NB : pour le type de graphique = Histogramme, il est possible de définir l’espacement entre les barres à droite et à gauche (en %). Cette option peut permettre, par exemple, de superposer deux graphiques en jouant sur l’espacement des barres de chaque graphique.

Onyxdesigner-image92.png

  • Attributs : permet de choisir le remplissage, le contour, l’épaisseur du contour, le motif, …

Onyxdesigner-image93.png


  • Positionnement : permet de placer les titres (X, Y, du graphique) et la légende, de redimensionner le graphique selon les préférences de l’utilisateur.

NB : La zone d’impression du graphique est celle délimitée par le grand rectangle donc tout ce qui ne sera pas dedans ne sera pas visible à l’impression (ex : la zone « Legend » est à l’extérieur du rectangle dans la première image ci-dessous alors qu’elle est dedans dans la deuxième).

Onyxdesigner-image94.png

Onyxdesigner-image95.png

  • La Légende se construit en sélectionnant les zones dans le spool qui serviront de légende pour les attributs choisis. Comme pour toute autre donnée, il faut nommer la zone comme le nom du graphique et renseigner les propriétés de la zone avec Type = « Graphique » et Sous-type = « Données de la légende ».

NB : Attention à respecter l’ordre des attributs en sélectionnant les zones qui serviront à la légende car elles suivront le même ordre que celui des attributs.

En créant un groupe

Le principe est le même que celui décrit ci-avant sauf que les données sont regroupées dans un groupe. Cette option est possible si les données du graphique se suivent dans le spool.

  • Créer un groupe qui définira les données à prendre en compte pour la construction du graphique et y déposer les zones sélectionnées qui contiennent les données, les titres, légende, ...
  • Nommer la/les zone(s) du même nom que le graphique et renseigner ses propriétés avec Type = « Graphique » et le Sous-type selon le rôle de la zone (titre, données, légende…).

La suite de la construction du graphique est la même que celle décrite précédemment.

Opérations arithmétiques dans un groupe

Pour simplifier la gestion de calcul dans un groupe et notamment la gestion de « total » et « sous-total », un outil a été intégré à Designer. Il permet d’effectuer des traitements sur un fichier XML d’entrée à l’aide de scripts. Ces scripts sont exécutés avant l’application de la maquette.

Onyxdesigner-image96.png

Onyxdesigner-image97.png

L’ajout de calcul dans un groupe, par l’intermédiaire de cet outil, se fait par la fonction de script « addline ». La fonction addline permet d’ajouter une ligne à un groupe, en lui précisant une séquence de couples « nom du champ/valeur » à ajouter.

De plus, les paramètres de type « chaine de caractère » devront être entourés de doubles guillemets et les noms de champ dans les formules par des simples guillemets.

Syntaxe :

addline(nom du groupe, nom de la ligne, ligne de type saut de page, nom du 1er champ, valeur du 1er champ, pré-calcul du 1er champ, nom du 2ème champ, valeur du 2ème champ, pré-calcul du 2ème champ, etc…) ;

La fonction addline commence par les arguments suivants :

  • Nom du groupe : Contient le nom du groupe sur lequel la ligne doit s’ajouter.
  • Nom de la ligne : Nom de la ligne à ajouter.

Puis, elle se compose d’une séquence illimitée de couples champ / valeur :

  • Nom du champ : Nom du champ que possèdera la ligne.
  • Valeur du champ : La valeur du champ possédé par la ligne.
  • Pré-calcul: Valeur booléenne. (0 ou 1, yes ou no). Si le champ possède un calcul alors cela permet de définir quand le calcul doit s’effectuer :
    • Yes : Le calcul est résolu lors de l’exécution du script, prenant en compte toutes les valeurs du xml.
    • No : Le calcul est résolu lors de l’utilisation de la valeur dans une maquette et ne prend donc en compte que les valeurs présentes dans la page en cours.

Par exemple, le script suivant ajoute cette ligne au groupe nommé "groupe" :

addline("groupe","ligne",yes,"champ1","valeur1",no,"champ2","valeur2",no);

<group name="groupe">

<line name="ligne" pagebreak=”1”>
<field name="champ1">valeur1</field>
<field name="champ2">valeur2</field>
</line>
</group>

La valeur du champ peut contenir un calcul dont la syntaxe est la suivante :

SUM('''''opération''''') pour calculer une somme sur l’ensemble des lignes du groupes.

AVG('''''opération''''') pour calculer une moyenne sur l’ensemble des lignes du groupes.

Ici, « opération » est un calcul mathématique utilisant les noms des champs présents dans les lignes du groupe. Les noms de champs doivent être entourés par des simples guillemets.

Prenons l’exemple de ce groupe :

<group name="invoice">
<line name="item">
<field name="name">item 1</field>
<field name="price">10</field>
<field name="quantity">2</field>
</line>
<line name="item">
<field name="name">item 2</field>
<field name="price">5</field>
<field name="quantity">3</field>
</line>
<line name="item">
<field name="name">item 3</field>
<field name="price">12</field>
<field name="quantity">4</field>
</line>
<line name="item">
<field name="name">item 4</field>
<field name="price">5.5</field>
<field name="quantity">3</field>
</line>
</group>

Pour ajouter une ligne de total à ce groupe, il faudra utiliser ce script :

addline("invoice", "LigneTotal",no

"total", "total = SUM('price'*'quantity')", yes

"moyenne", "moyenne = AVG('price'*'quantity')", yes

);

Ce script aura pour effet d’ajouter une ligne de total à la fin du groupe :

<group name="invoice">

<line name="item">
<field name="name">item 4</field>
<field name="price">5.5</field>
<field name="quantity">3</field>
</line>
<line name="LigneTotal">
<field name="total">total = 99.5</field>
<field name="moyenne">moyenne = 24.875</field>
</line>
</group>

L’utilisation de l’option Pré-calcul à « no » permet de ne pas exécuter les calculs lors de l’ajout de la ligne au groupe mais lors de son exécution par la maquette. L’intérêt de cette option est de pouvoir effectuer des calculs uniquement avec les données écrites sur la page en cours, permettant donc l’écriture de sous-totaux.

Pour ajouter une ligne de sous-total au groupe précédant, il faudra utiliser ce script :

addline("invoice","LineSubtotal",yes, "subtotal","sous-total = SUM('price'*'quantity')",no);

Ce script aura pour effet d’ajouter une ligne de total à la fin du groupe :

<group name="invoice">

<line name="item">
<field name="name">item 4</field>
<field name="price">5.5</field>
<field name="quantity">3</field>
</line>
<line name="LineSubtotal" pagebreak=”1”>
<field name="subtotal">sous-total = SUM('price'*'quantity')</field>
</line>
</group>

Gestion de la pagination

La gestion de l’écriture d’information de pagination tels que le nombre de page total, le nombre de lot et le nombre de page dans le lot est possible dans Designer grâce aux deux options suivantes.

Rupture de lot

L’option Rupture de lot se trouve dans les Propriétés de la maquette (présentée dans le paragraphe 4.2. Création d’un projet). Elle permet de définir une zone de type Metadata qui sera utilisée pour regrouper les pages du document final en lot.

Onyxdesigner-image98.png

Lors du traitement de la page :

  • Si la zone Metadata récupère une nouvelle valeur alors un nouveau lot sera créé. La page en cours appartiendra à ce nouveau lot.
  • Si la zone Metadata récupère une valeur déjà récupérée précédemment, la page en cours sera déplacée vers le lot correspondant à cette valeur.
  • Si aucune valeur n’est récupérée par la zone Metadata, la page reste dans le même lot que la page précédente.

C’est le système de multi-document du XPS qui est utilisé pour représenter les lots, le fichier de sortie est donc trié par lot (d’abord les pages du premier lot puis les pages du second, etc…).

Variables de remplacement

Pour permettre l’écriture des informations de pagination, il existe des variables de type « post-traitement », c’est-à-dire qu’elles ne seront remplacées par leur véritable valeur qu’au moment de l’impression.

Ces variables, qui peuvent être utilisées dans des zones ou dans des blocs de texte, sont les suivantes :

MAP_TOTAL_PAGE = nombre total de page.

MAP_TOTAL_DOC = nombre total de lot.

MAP_TOTAL_PAGE_IN_DOC = nombre de page dans le lot en cours.

La syntaxe d’utilisation est la suivante :

PST:'''''nom de la variable''''';'''''valeur par défaut'''''

La « valeur par défaut » est obligatoire et permet d’avoir un texte présent dans la page. Ce texte temporaire sera, par la suite, remplacé par sa vraie valeur. Il est important car c’est grâce à ce texte que les calculs de positionnement se feront. Ce texte doit donc posséder un nombre de caractère au moins égal à la valeur maximale attendue par la variable utilisée.

Par exemple :

PST:MAP_TOTAL_PAGE;000

Affichera "000" dans la page, mais au moment de l’impression cette valeur sera remplacée par :

  • " 5" s’il y 5 pages au total.
  • " 10" s’il y 10 pages au total.
  • "150" s’il y 150 pages au total.

D’autre syntaxes existent aussi, accessibles quant à elles pendant le traitement de la page :

VAR:MAP_CURRENT_PAGE = numéro de la page en cours.

VAR:MAP_CURRENT_DOC = numéro du lot en cours (la zone Metadata gérant la rupture de lot doit être définie avant l’utilisation de cette variable).

VAR:MAP_CURRENT_PAGE_IN_DOC = numéro de la page en cours dans le lot en cours.

Et de manière générale :

VAR:variable d’env = récupère le contenu de la variable d’environnement.

Gestion des veuves et orphelines

Une gestion complexe des veuves et orphelines est possible grâce à deux fonctionnalités : Groupe entier et Répéter un groupe XML.

Groupe entier

Lorsqu’on utilise une génération de saut de page de type Limite, une nouvelle option apparait dans les Propriétés du groupe : Groupe entier. Cette option permet d’indiquer que le groupe ne peut pas être coupé et qu’il doit donc s’imprimer intégralement sur une seule page. Si la limite déclenche un saut de page, aucune ligne du groupe ne sera imprimée, le groupe sera entièrement traité sur la page suivante.

Onyxdesigner-image99.png

Répétition de groupe XML

La répétition de groupe XML part du principe que le groupe apparait plusieurs fois dans le fichier XML d’entrée. Cette fonctionnalité s’active avec le paramètre « Répéter » dans les propriétés du groupe.

Onyxdesigner-image100.png

Exemple :

Dans l’exemple ci-dessous, le groupe “invoice” apparait trois fois dans le XML. Par défaut, le groupe de la maquette ne pourra récupérer que les informations de la première apparition du groupe dans le XML. Mais si l’option « Répéter » est cochée, l’exécution du groupe se poursuivra sur toutes les apparitions.

<group name="invoice">
<line name="item">
<field name="name">item 1</field>
<field name="price">10</field>
<field name="quantity">2</field>
</line>
<line name="description">
<field name="description">Description item 1</field>
</line>
</group>
<group name="invoice">
<line name="item">
<field name="name">item 2</field>
<field name="price">5</field>
<field name="quantity">3</field>
</line>
<line name="description">
<field name="description">Description item 2</field>
</line>
</group>
<group name="invoice">
<line name="item">
<field name="name">item 3</field>
<field name="price">12</field>
<field name="quantity">4</field>
</line>
<line name="description">
<field name="description">Description item 3</field>
</line>
</group>

L’utilisation conjointe d’une limite générant des sauts de page avec l’option “Groupe entier” et la répétition active permet de gérer un système complexe de veuves et orphelines.

Dans notre exemple, les lignes « item » et les lignes « description » ne pourront pas être séparées par un saut de page.