Difference between revisions of "Custom Field Type: Special - Advanced Data Table"

From SmartWiki
Jump to: navigation, search
(Created page with 'The XML Field Type is used to store a block of XML. The XML stored in this field can be: * Copied and Pasted from a source file. * Stored into the field from a workflow proc…')
 
Line 62: Line 62:
 
==Variable Examples==
 
==Variable Examples==
  
-------- Sample 1 ----------
 
Created By: @xml.mypasta.Author.Firstname.nodevalue@ @xml.mypasta.Author.Lastname.nodevalue@
 
'''Output:''' Created By Wendy Houston
 
  
-------- Sample 2 ----------
+
Created By @xml.mypasta.Author.Firstname.nodevalue@ @xml.mypasta.Author.Lastname.nodevalue@
 +
* '''Result''': Created By Wendy Houston
 +
 
 +
 
 
  @xml.mypasta.Author.Address.Street.nodevalue@ @xml.mypasta.Author.Address.postalcode.nodevalue@
 
  @xml.mypasta.Author.Address.Street.nodevalue@ @xml.mypasta.Author.Address.postalcode.nodevalue@
Output: 148 Peter Street L7Y 2P5
+
* '''Result''': 148 Peter Street L7Y 2P5
 +
 
 +
 
  
-------- Sample 3 ----------
 
 
  @xml.mypasta.title.nodevalue@   
 
  @xml.mypasta.title.nodevalue@   
 
  @xml.mypasta.comment.nodevalue@  
 
  @xml.mypasta.comment.nodevalue@  
 
  Calories=@xml.mypasta.nutrition.attributes(calories)@
 
  Calories=@xml.mypasta.nutrition.attributes(calories)@
Output:
+
* '''Result''':
Beef Parmesan with Garlic Angel Hair Pasta  
+
Beef Parmesan with Garlic Angel Hair Pasta<br />
Make the meat ahead of time, and refrigerate over night, the acid in the  tomato sauce will tenderize the meat even more. If you do this, save the  mozzarella till the last minute.
+
Make the meat ahead of time, and refrigerate over night, the acid in the  tomato sauce will tenderize the meat even more. If you do this, save the  mozzarella till the last minute.<br />
 
Calories=1167
 
Calories=1167
  
-------- Sample 4 ----------
+
 
 
  Ingredients
 
  Ingredients
  ---Name---amount---unit
+
  Name - amount - unit
  @xml.mypasta.ingredients.ingredient[#---~nodevalue~---~attributes(amount)~---~attributes(unit)~-#]@
+
  @xml.mypasta.ingredients.ingredient[#~nodevalue~ - ~attributes(amount)~ - ~attributes(unit)~#]@
Output:
+
* '''Result''':
Ingredients
+
Ingredients<br />
---Name---amount---unit
+
Name - amount - unit<br />
---Beef cube---1.5---pound
+
Beef cube - 1.5 - pound<br />
---Italian Pasta---2---kg
+
Italian Pasta - 2 - kg
 +
 
  
-------- Sample 5 ----------
 
 
  Steps
 
  Steps
  ---Order---Description
+
  Order Description
  @xml.mypasta.preparation.step[#---~attributes(order)~---~description.nodevalue~-#]@
+
  @xml.mypasta.preparation.step[#~attributes(order)~ ~description.nodevalue~#]@
Output :
+
* '''Result''':
Steps
+
Steps<br />
---Order---Description
+
Order Description<br />
---1---Preheat oven to 350 degrees F (175 degrees C).
+
1 Preheat oven to 350 degrees F (175 degrees C).<br />
---2---Mix all ingredients.
+
2 Mix all ingredients.<br />
---3---Put everything into oven.
+
3 Put everything into oven.<br />
---4---Done.
+
4 Done.<br />
---5---Find a phone number of the closest take out restaurant.
+
5 Find a phone number of the closest take out restaurant.
  
  
 
[[Category:Custom Fields]]
 
[[Category:Custom Fields]]

Revision as of 01:10, 30 January 2011

The XML Field Type is used to store a block of XML.

The XML stored in this field can be:

  • Copied and Pasted from a source file.
  • Stored into the field from a workflow process using the SmartSimple Integration Server.
  • Other Web Service types processes.

Example

Here is an example of XML field called mypasta which stores a recipe (Note that although this stores only one, multiple recipes could be stored in the same block of XML):

<?xml version="1.0" encoding="UTF-8"?>
<recipe>
   <title>Beef Parmesan with Garlic Angel Hair Pasta</title>
   <Author>
      <Firstname>Wendy</Firstname>
      <Lastname>Houston</Lastname>
      <Address>
         <Street>148 Peter Street</Street>
         <postalcode>L7Y 2P5</postalcode>
      </Address>
   </Author>
   <ingredients>
      <ingredient amount="1.5" unit="pound">Beef cube</ingredient>
      <ingredient amount="2" unit="kg">Italian Pasta</ingredient>
   </ingredients>
   <preparation>
      <step order='1'>
         <description>Preheat oven to 350 degrees F (175 degrees C).</description>
      </step>
      <step order='2'>
         <description>Mix all ingredients.</description>
      </step
      <step order='3'>
         <description>Put everything into oven.</description>
      </step>
         <description>Done.</description>
      </step>
     <step order='5'>
        <description>Find a phone number of the closest take out restaurant.</description> 
     </step>
   </preparation>
   <comment> Make the meat ahead of time, and refrigerate over night, the acid in the  tomato sauce will tenderize the meat even more. 
            If you do this, save the  mozzarella till the last minute.
   </comment>
   <nutrition calories="1167" fat="23" carbohydrates="45" protein="32"/>
</recipe>


Variables

Access to the data within the XML field uses standard SmartSimple variable references.

* @xml.fieldname.nodename.nodevalue@

  • @xml.#fieldid#.nodename.nodevalue@
  • @xml.fieldname.nodename.attribute(attribute name)@

For child records: * @xml.fieldname.nodename[# ~nodevalue~ ~attributes(attribute name)~ #]@

  • @xml.fieldname.nodename[# ~childnode.nodevalue~ ~childnode.attributes(attribute name)~ #]@


Variable Examples

Created By @xml.mypasta.Author.Firstname.nodevalue@ @xml.mypasta.Author.Lastname.nodevalue@
  • Result: Created By Wendy Houston


@xml.mypasta.Author.Address.Street.nodevalue@ @xml.mypasta.Author.Address.postalcode.nodevalue@
  • Result: 148 Peter Street L7Y 2P5


@xml.mypasta.title.nodevalue@  
@xml.mypasta.comment.nodevalue@ 
Calories=@xml.mypasta.nutrition.attributes(calories)@
  • Result:

Beef Parmesan with Garlic Angel Hair Pasta
Make the meat ahead of time, and refrigerate over night, the acid in the tomato sauce will tenderize the meat even more. If you do this, save the mozzarella till the last minute.
Calories=1167


Ingredients
Name - amount - unit
@xml.mypasta.ingredients.ingredient[#~nodevalue~ - ~attributes(amount)~ - ~attributes(unit)~#]@
  • Result:

Ingredients
Name - amount - unit
Beef cube - 1.5 - pound
Italian Pasta - 2 - kg


Steps
Order Description
@xml.mypasta.preparation.step[#~attributes(order)~ ~description.nodevalue~#]@
  • Result:

Steps
Order Description
1 Preheat oven to 350 degrees F (175 degrees C).
2 Mix all ingredients.
3 Put everything into oven.
4 Done.
5 Find a phone number of the closest take out restaurant.