Advanced Field Functions

Aus Wiki csv4you
Wechseln zu:Navigation, Suche
Sprachen:
Deutsch • ‎English

Advanced Field Codes are especially suitable for custom formatting, calculations and queries of individual column contents in imports and exports. Please pay attention to the correct use of the pipe |, the single quotes' and the curved {} and square [] brackets.

Please, use these functions only as specified in the examples herein. We do not provide support for faulty, multiple or incorrectly nested functions that are not listed in the following examples.

spec* - Usage of additional Data Fields

Up to 20 additional, individual fields, e.g. for columns of the import file that do not match any of the existing field labels, can be defined under Data Pool ->Preferences ->Actions. The assignment of these free fields is done in the Import and Export settings via the placeholder [spec1], [spec2], and so on ... up to [spec20].

spec1, spec2, spec3, spec4 ... - Assigning free fields

Example: You have given your first free field the name 'Mobile Link' since your import file contains such a column with corresponding values. All values of this column can be read or assigned via the following placeholder: [spec1]

Format, calculate and filter cell content

replace - Replacing Cell Content

The replace function substitutes one value through another. As a separator, any character can be specified. However, this can not be the Pipe (|) or the value that is to be replaced. Within the 'replace' function no quotes are used.

Example 1... The comma in the price cell shall be replaced by a dot. Separator is the colon (:).

[price|replace:,:.]

Example 2... Double colons in the attribute cell shall be replaced by a single colon. Separator is the hash mark (#). In this case do not use the colon as separator, because the values to be replaced are colons!

[attributes|replace#::#:]

truncate - Truncating Cell Content

Example ... From a cell 'ImageName1' in your import file only the first 4 characters ahall be outputed or imported:

[pic1|truncate:4]

Example ... From your SKU number you want to import 6 characters starting at position 3:

[itemno|truncate:6:3]

lowercase - Cell Content with lower Case Letters

Example ... ImageName1 "GTN765.jpg" shall be converted to lowercase (gtn 756.jpg):

[pic1|lowercase]

net - Net Price

Example ... Your import file contains gross prices. However, you need the net price, without the contained VAT:

[price|net]

html - Text with HTML

Example ... All text descriptions shall be imported with HTML tags (if any):

[description|html]

text - Text w/o HTML but, with Linebreaks

Beispiel... Aus den Artikelbeschreibungen Ihrer Importdatei werden ggf. vorhandene HTML-Tags entfernt und nur der eigentliche Text wird importiert. Zeilenumbrüche im Text werden formatiert ausgegeben:

[description|text]

clear - Text w/o HTML and w/o Linebreaks

Beispiel... Alle Beschreibungen werden unformatiert und ohne Zeilenumbrüche als fortlaufender Text dargestellt:

[description|clear]

split - Extracting Data from a Data Field with Separators

Beispiel 1... Feldinhalt sieht wie folgt aus: "Bildpfad1|Bildpfad2|Bildpfad3]". Als Datentrenner im System bei uns ist als Standardtrenner die Pipe | voreingestellt (senkrechter Strich). Es soll nur der Wert 'Bildpfad2' übernommen werden:

[FeldNameBild|split:2]

Beispiel 2... Feldinhalt: "Bildpfad1|-|Bildpfad2|-|Bildpfad3". Datentrenner 2 Pipes mit Bindestrich in der Mitte |-| (als Beispiel für einen eigenen Trenner). Aus dem Feldinhalt mit 3 Werten soll nur der Wert "Bildpfad3" übernommen werden:

[FeldNameBild|split:3:|-|]

Beispiel 3... Feldinhalt eines Feldes 'Category': "Möbel|Wohnzimmer|Sessel". Datentrenner ist wieder die Pipe. Wenn Sie einen anderen Trenner verwenden, dann bitte im Beispiel 2 schauen. In 3 Spalten wird die Übernahme der einzelnen Werte "Möbel", "Wohnzimmer" und "Sessel" wie folgt vorbereitet:

[Category|split:1]
[Category|split:2]
[Category|split:3]

math - Calculations

Beispiel 1... Addiere 100 auf den aktuellen Preis:

[math|price+100]

Beispiel 2... Multipliziere den aktuellen Preis mit 1.5, benutze als Dezimaltrennzeichen den Punkt:

[math|price*1.5|.]

Beispiel 3... Addiere Inhalte aus den Feldern 'price' und 'shippingCost':

[math|price+shippingCost]

Beispiel 4... Addiere/berechne 4 Werte in einem Feld: Importpreis [price_list] + Mehrwertsteuer [vat] + 20% Aufschlag + 5 Euro pauschal

[math|price_list*1.vat*1.2+5]

date() - Date Values

Beispiel 1... Aktuelles Startdatum mit Angabe Stunde und Minute (z.B. für Auktionen):

date(d.m.Y H:i)

Beispiel 2... Aktuelles Startdatum mit zusätzlicher Angabe der Sekunden ausgeben:

date(d.m.Y H:i:s)

Beispiel 3... Startdatum mit Stunde und Minute jedoch 2 Tage zurück gesetzt:

date(d.m.Y H:i|-2)

Nesting of Functions

[func1 {func2}] - Joining two Functions

Beispiel 1... Ersetzt in einem String https in http und a-domain.com in b-domain.com:

[pic1|replace:'https':'http'{replace:'a-domain.com':'b-domain.com'}]

Beispiel 2... Sie möchten Datumswerte, z.B. "10.09.2015 17:55:49" in "10.09.2016" ändern. Dazu muss der 1. Teil des Datums gesucht und '2015' durch '2016' ersetzt werden. Der Trenner ist das Leerzeichen:

[Datum|split:1: {replace:'2015':'2016'}]

[func1 {func2}{func3}] - Joining three Functions

Beispiel... Der Titel "Kette, schwarz-rot Metallik, 80cm" wird in "metallic" umgewandelt. Dazu muss der 3. Teil des Titels gesucht, alle Buchstaben klein geschrieben und ein Buchstabe ersetzt werden. Als Trennzeichen der Werte innerhalb des Titels wird das Leerzeichen definiert (vor der ersten geschwungenen Klammer):

[title|split:3: {lowercase}{replace:'k':'c'}]

Conditional Statements and Branches (Queries)

IF - Statement

Beispiel... Wenn 'SpalteBestand' Wert größer 5, schreibe 5 - ansonsten schreibe nichts in das Feld:

{IF 'SpalteBestand' > '5'}5{ENDIF}

IF-ELSE - Statement

Beispiel 1... Wenn 'SpalteVerfuegbar' Wert nicht wie 'ja', schreibe 0 - ansonsten schreibe 1.

{IF 'SpalteVerfuegbar' != 'ja'}0{ELSE}1{ENDIF}

Beispiel 2... Wenn 'Lager' Wert leer, schreibe 'nein' - ansonsten schreibe 'ja'.

{IF 'Lager' == ''}nein{ELSE}ja{ENDIF}

IF-ELSEIF-ELSE - Statement

Beispiel 1... Wenn 'SpalteVerfuegbar' Wert=nein, schreibe 0 - wenn 'SpalteVerfuegbar' Wert=ja, schreibe 1 - wenn Beides nicht zutrifft schreibe nichts in das Feld.

{IF 'SpalteVerfuegbar' == 'nein'}0{ELSEIF 'SpalteVerfuegbar' == 'ja'}1{ELSE}{ENDIF}

Beispiel 2... ist etwas komplexer. Es gibt z.B. Variantenfelder für Konfektionsgrößen. Der folgende Code ersetzt die Größenangaben 36-54 aus der Importdatei (Feldname: 'Variation_Size') in die gewünschten Buchstaben-Größenbezeichner, z.B. S, M, L, XL usw.:

{IF 'Variation_Size' == '36'}XXS
 {ELSEIF 'Variation_Size' == '38'}XS
 {ELSEIF 'Variation_Size' == '40'}S
 {ELSEIF 'Variation_Size' == '42'}M
 {ELSEIF 'Variation_Size' == '44'}L
 {ELSEIF 'Variation_Size' == '46'}XL
 {ELSEIF 'Variation_Size' == '48'}XXL
 {ELSEIF 'Variation_Size' == '50'}3XL
 {ELSEIF 'Variation_Size' == '52'}4XL
 {ELSEIF 'Variation_Size' == '54'}5XL
 {ELSE}6XL
{ENDIF}

IF-ELSE-ELSE - Statement

Beispiel... Wenn Spalte 'Aktiv' Wert='Ja', übernehme Wert aus Spalte 'Bestand' - ansonsten wenn Wert 'Bestand' größer 10, schreibe '10' - ansonsten schreibe '0' in das Feld.

{IF 'Aktiv' == 'Ja'}[Bestand]{ELSE}{IF 'Bestand' > '10'}10{ELSE}0{ENDIF}{ENDIF}

Interfaces specific Placeholders

WooCommerce

ASIN-Platzhalter

[ASIN-{COUNTRY}]

More functions will be added as required and on request.