{"id":6565,"date":"2018-04-17T17:02:34","date_gmt":"2018-04-17T17:02:34","guid":{"rendered":"https:\/\/alt2.minisoft.com\/support\/?p=6565"},"modified":"2020-07-02T10:42:10","modified_gmt":"2020-07-02T17:42:10","slug":"load-variable-from-project-output","status":"publish","type":"post","link":"https:\/\/c002.minisoft.com\/support\/load-variable-from-project-output\/","title":{"rendered":"Load Variable from Project Output"},"content":{"rendered":"<p>Load Variable from Project Output is a procedure action with a variety of potential uses, as the following examples illustrate:<\/p>\n<ul>\n<li>Pass XML data to a project to transform into some other XML format.<\/li>\n<li>Given an order ID, look up the order details from a database, returning the order information in XML format.<\/li>\n<li>Given an error code, call a subproject to convert it into an error message. This encapsulates the details of obtaining the error message into that one project.<\/li>\n<\/ul>\n<p>To add this action to an existing procedure, right-click on the Procedure, select \u201cAdd Action\u201d, then select \u201cLoad Variable from Project Output\u2026\u201d<\/p>\n<p><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6566\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj1.png\" alt=\"\" width=\"446\" height=\"491\" srcset=\"https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj1.png 446w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj1-273x300.png 273w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj1-136x150.png 136w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj1-250x275.png 250w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj1-164x180.png 164w\" sizes=\"(max-width: 446px) 100vw, 446px\" \/><\/a><\/p>\n<p>1) From the Project field, select the project to call.<br \/>\n2) Select the type of input, from a component or from the procedure variable.<br \/>\n3) Set the Input format appropriately for the input data. If it is XML, the Character set will typically be UTF-8.<br \/>\n4) Add any parameters to be passed to the project. See the <a href=\"\/support\/index.php\/sub-projects\/\">Calling Sub-Projects<\/a> article for more information about passing parameters and accessing those parameters in the subproject. Set the Output format for the type of data the sub-project will return.<\/p>\n<p>On the other hand, if the sub-project will return plain text, set the Output format to Text and the Character set to an appropriate value for the data being returned, perhaps ISO-8859-1. Regardless of the type of data the sub-project returns, place the data into a variable to be able to use it later in the project, by placing a \u201c<a href=\"\/support\/index.php\/set-variable\/\">Set Variable<\/a>\u201d action immediately after the \u201cLoad from Project Output\u201d action:<\/p>\n<p><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6567\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj2.png\" alt=\"\" width=\"263\" height=\"63\" srcset=\"https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj2.png 263w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj2-150x36.png 150w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj2-250x60.png 250w\" sizes=\"(max-width: 263px) 100vw, 263px\" \/><\/a><\/p>\n<p>In this example, the XML returned by the sub-project is now stored in the variable XMLPackslip. If the sub-project returns a single text value, you may need to do a <a href=\"\/support\/index.php\/right-left-trim\/\">Left Trim<\/a> and a <a href=\"\/support\/index.php\/right-left-trim\/\">Right Trim<\/a> to remove any leading and trailing carriage return and\/or new line characters. Here is an example:<\/p>\n<p><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj3.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6568\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj3.png\" alt=\"\" width=\"446\" height=\"491\" srcset=\"https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj3.png 446w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj3-273x300.png 273w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj3-136x150.png 136w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj3-250x275.png 250w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj3-164x180.png 164w\" sizes=\"(max-width: 446px) 100vw, 446px\" \/><\/a><\/p>\n<p>After this call, we set the value into the variable FolderID:<\/p>\n<p><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj4.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6569\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj4.png\" alt=\"\" width=\"303\" height=\"82\" srcset=\"https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj4.png 303w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj4-300x82.png 300w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj4-150x41.png 150w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj4-250x68.png 250w\" sizes=\"(max-width: 303px) 100vw, 303px\" \/><\/a><\/p>\n<p>But the FolderID variable starts and ends with a CR\/LF (carriage return\/line feed), represented by \\r\\n.<\/p>\n<p><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj5.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6570\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj5.png\" alt=\"\" width=\"516\" height=\"73\" srcset=\"https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj5.png 516w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj5-300x42.png 300w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj5-150x21.png 150w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj5-250x35.png 250w\" sizes=\"(max-width: 516px) 100vw, 516px\" \/><\/a><\/p>\n<p>We can apply a Right Trim and a Left Trim function to the variable, either in the definition or in the procedure, before setting the value returned from the sub-project into the FolderID variable.<\/p>\n<p><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj6.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6572\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj6.png\" alt=\"\" width=\"131\" height=\"54\" \/><\/a><\/p>\n<p><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj7.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6571\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj7.png\" alt=\"\" width=\"298\" height=\"112\" srcset=\"https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj7.png 298w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj7-150x56.png 150w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj7-250x94.png 250w\" sizes=\"(max-width: 298px) 100vw, 298px\" \/><\/a><\/p>\n<p>We can see that the value of FolderID no longer has the leading and trailing \\r\\n:<\/p>\n<p><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj8.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6573\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj8.png\" alt=\"\" width=\"298\" height=\"70\" srcset=\"https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj8.png 298w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj8-150x35.png 150w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2018\/04\/VarFromProj8-250x59.png 250w\" sizes=\"(max-width: 298px) 100vw, 298px\" \/><\/a><\/p>\n<p>In summary, the Load Variable from Output action can be useful for calling a sub-project that will return data to be used in further processing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Load Variable from Project Output is a procedure action with a variety of potential uses, as the following examples illustrate: Pass XML data to a project to transform into some other XML format. Given an order ID, look up the order details from a database, returning the order information in XML format. Given an error [&hellip;]<\/p>\n","protected":false},"author":75,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[108,19,50],"_links":{"self":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/6565"}],"collection":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/users\/75"}],"replies":[{"embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/comments?post=6565"}],"version-history":[{"count":2,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/6565\/revisions"}],"predecessor-version":[{"id":8209,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/6565\/revisions\/8209"}],"wp:attachment":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/media?parent=6565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/categories?post=6565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/tags?post=6565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}