Mattang-Dan opened a new issue, #3185:
URL: https://github.com/apache/hop/issues/3185

   ### What needs to happen?
   
   Below is the text of a new page, but it is also attached including pictures 
in MS Word.
   
   **Fields, parameters, and variables**
   Fields, parameters, and variables implicitly are available downstream if in 
scope. You can pass them again any number of levels, but the "get 
parameters/variables" button only retrieves from one level above.
   
   **Fields**: Fields are columns in data row(s) and are viewable in some 
transform field textboxes and columns and you can see the fields in scope and 
its value when looking at transform row results after executing a 
workflow/pipeline (click the little grid icon on the bottom-right of a 
transform to see a preview of the cached results). Field values can be passed 
upstream for example if you use a pipeline executor and fill in the Result rows 
tab and use it in conjunction with a “copy rows to result” transform in the 
child pipeline.
   
   **Parameters**: Think of parameters as function arguments, which turn into 
variables with the same name. When adding parameters you are basically creating 
MyPipeline(parameter1, parameter2,..). Parameters only need to be created and 
declared once in a workflow. Parameters can be passed upstream by using “Set 
variables”, but then they are not parameters anymore but variables. If you set 
a parameter to a default value in becomes explicit (e.g. when editing a 
pipeline in pipeline properties), it will take precedence over the same named 
implicit variable (a passed-in variable), but not take precedence over the same 
named implicit parameter. So whenever you see a transform with a column title 
“Parameters/Variables” that simply means an explicit parameter is sent to a 
function that will then set a variable name overriding any previous set 
parameter with the same name (useful if wanting to override an explicitly set 
param/variable in the child).
              
   To change implicit parameter behavior to explicit, you can also disable 
“pass all parameters” on the pipeline action. Parameters are simply variables 
which are explicitly defined in a workflow or pipeline to make them 
recognizable from outside those objects. They can also have a description and a 
default value.
   
   You cannot combine implicit variable inheritance with explicit parameter 
definitions. So, if you add parameters to the pipeline definition (or to a 
pipeline executor) and you want it set, you must add it to the parameters tab 
of the child pipeline action/transform even if the same variable already exists.
   
   Advanced: there are multiple layers in hop where you can set variables that 
do or do not get overwritten downstream (Java -> hop environment -> project -> 
run configuration -> workflow -> pipeline).
   
   **Variables**: Variables are more global and the scope can be targeted 
(entire Java VM, root workflow, etc.) whereas fields are the data flowing 
between the transforms. Local variables can be set in a pipeline but should not 
be used in the same pipeline as they are not thread-safe and can inherit a 
previous value. It is better to send or return variables to another 
pipeline/workflow before using them.  Variables can be passed upstream if the 
variable was set to a larger scope. E.g.: if a variable was set in a parent 
with “valid in the current workflow”.
   
   **Think of variables in 2 scopes:** runtime variables and 
environment/workflow variables
   •    **Runtime variables** – Runtime variables depend on pipeline 
information to generate, so they cannot be set beforehand, you need to declare 
those differently to be able to use them.
   •    **Environment/workflow variables or parameters** – Environment 
variables/parameters are set once and used when needed in any downstream 
workflow/pipeline and there is no need to use Get Variables , you can refer to 
them directly like ${myVariable} unless you need it in a field/data stream.
        o       E.g.: Define a parameter only once, even just in the Pipeline 
Executor (no need to define in receiving pipeline)
   A pipeline needs to start to get new variables. A running or nested pipeline 
can't fetch new variable values. A pipeline is considered started when a 
pipeline starts for every row in a pipeline executor. An alternative is to use 
parameters.
   
   [Fields and Parameters and 
Variables.docx](https://github.com/apache/hop/files/12476436/Fields.and.Parameters.and.Variables.docx)
   
   
   ### Issue Priority
   
   Priority: 3
   
   ### Issue Component
   
   Component: Documentation


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@hop.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to