Erweiterte Feldfunktionen/en: Unterschied zwischen den Versionen

Aus Wiki csv4you
Wechseln zu:Navigation, Suche
(Die Seite wurde neu angelegt: „Example 1 ... If value of column 'Available' = no, write 0 - if value of column 'Available' = yes, write 1 - if both are FALSE, write nothing in the cell. {IF…“)
(Die Seite wurde neu angelegt: „Example ... If column 'Active' value = 'yes', accept value from column 'Inventory' as is - otherwise if value 'inventory' is greater 10, write '10' - otherwis…“)
Zeile 134: Zeile 134:
 
=== '''IF-ELSE-ELSE''' - Statement ===
 
=== '''IF-ELSE-ELSE''' - Statement ===
  
Beispiel... Wenn Spalte 'Aktiv' Wert='Ja', übernehme Wert aus Spalte 'Bestand' -
+
Example ...  
ansonsten wenn Wert 'Bestand' größer 10, schreibe '10' -
+
If column 'Active' value = 'yes', accept value from column 'Inventory' as is -
ansonsten schreibe '0' in das Feld.
+
otherwise if value 'inventory' is greater 10, write '10' -
  {IF 'Aktiv' == 'Ja'}[Bestand]{ELSE}{IF 'Bestand' > '10'}10{ELSE}0{ENDIF}{ENDIF}
+
otherwise write '0' in the cell.
 +
  {IF 'Active' == 'Ja'}[Inventory]{ELSE}{IF 'Inventory' > '10'}10{ELSE}0{ENDIF}{ENDIF}
  
 
== Interfaces specific Placeholders ==
 
== Interfaces specific Placeholders ==

Version vom 4. März 2016, 16:45 Uhr

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

Existing HTML tags (if any), from the product descriptions of your import file, are removed and only the actual text is imported. HTML line breaks in the text are re-formatted as text line breaks:

[description|text]

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

Example ... All descriptions are outputed as unformatted, continuous text without line breaks:

[description|clear]

split - Extracting Data from a Data Field with Separators

Example 1 ... cell content is as follows: "Image Path 1 | Image Path 2 | Image Path 3". As default data separator in the system is the pipe character ("|") preset. Only the value of 'Image Path 2' shall be taken:

[FeldNameBild|split:2]

Example 2 ... cell content: "Image Path 1 | - | Image Path 2 | - | Image Path 3". Data separator are 2 Pipes hyphenated in the middle | - | (as an example for an individual Separator). From the cell content with 3 values only the value of "Image Path 3" shall be taken:

[FeldNameBild|split:3:|-|]

Example 3 ... cell contents of a field 'Category': "Furniture|Living Room|Chair". Data separator is the pipe again. If you use a individual separator, please see example 2 for guidance. The acquisition of the values "Furniture", "Living Room" and "Chair" in 3 separate cells is prepared as follows:

[Category1|split:1]
[Category2|split:2]
[Category3|split:3]

math - Calculations

Example 1 ... Add 100 to the current price:

[math|price+100]

Example 2 ... Multiply the current price by 1.5; use a dot as the decimal separator:

[math|price*1.5|.]

Example 3 ... Add the values of the cells 'price' and 'shipping cost':

[math|price+shippingCost]

Example 4 ... Add/compute 4 values in one field: Import Price [price_list] + VAT [vat] + 20% surcharge + 5 (EUR) flat

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

date() - Date Values

Example 1 ... Start date (for example, for auctions) specifying hour and minute:

date(d.m.Y H:i)

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

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

Example 3 ... start date with hour and minute but set 2 days back:

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

Nesting of Functions

[func1 {func2}] - Joining two Functions

Example 1 ... Replaces in a stringhttps with http and a-domain.com with b-domain.com:

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

Example 2 ... you want change date values; for example, "09.10.2015 17:55:49" in "09.10.2016". This requires that the first part of the date is selected and in there '2015' is replaced by '2016'. The separator is a blank:

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

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

Example ... In the title "Chain, black, red Metallik, 80cm" "Metallik" is converted to "metallic". This requires that the third part of the title is found, all the letters are written in lower case and a letter is replaced. As separator of the values within the title the blank is defined (before the first curly brace):

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

Conditional Statements and Branches (Queries)

IF - Statement

Example ... If the value in the column 'Inventory' is greater than 5, write 5 - otherwise do not write anything in this cell:

{IF 'Inventory' > '5'}5{ENDIF}

IF-ELSE - Statement

Example 1 ... If column 'Available' value is not 'yes', write 0 - otherwise write 1

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

Example 2 ... If 'Stock' value is empty, write 'no' - otherwise write 'yes'.

{IF 'Stock' == }no{ELSE}ja{ENDIF}

IF-ELSEIF-ELSE - Statement

Example 1 ... If value of column 'Available' = no, write 0 - if value of column 'Available' = yes, write 1 - if both are FALSE, write nothing in the cell.

{IF 'Available' == 'no'}0{ELSEIF 'Available' == 'yes'}1{ELSE}{ENDIF}

Example 2 ... is a bit more complex. There are, for example, variant cells for clothing sizes. The following code replaces the size designations 36-54 from the import file (column name: 'Variation_Size') with the desired letter named sizes, for example, S, M, L, XL, etc.:

{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

Example ... If column 'Active' value = 'yes', accept value from column 'Inventory' as is - otherwise if value 'inventory' is greater 10, write '10' - otherwise write '0' in the cell.

{IF 'Active' == 'Ja'}[Inventory]{ELSE}{IF 'Inventory' > '10'}10{ELSE}0{ENDIF}{ENDIF}

Interfaces specific Placeholders

WooCommerce

ASIN-Platzhalter

[ASIN-{COUNTRY}]

More functions will be added as required and on request.