Dealing with Enviroment values of BuildForge
Hi,
I have defined a Project and defined Environment in Pulldown options Adapter_Name= SAPAdapter,EmailAdapter,etc Project is defined with several steps , and 1 of the step need different value for Adapter_Name, like sap, email etc, so I have created ENV variable and have assigned Adapter_Name=sap,email etc But while executing the project, defined step is not able to take the respective values dynamically instead its taking default value which is defined at the top Please help me in assigning the Environment values dynamically. I have attached some file for your reference. |
11 answers
Hi, Hi, I'm hoping that I understand your project. If so, it seems that you would like to set the value of a variable based off the existing value of a variable. In your project you have an environment at the project level in the pull down, and based off the selection in the pull down, one of the steps needs to change the value based off that value. A way to do this would be to combine a few features of Build Forge. It will require some changes in your project structure. The JPO feature introduced with v7.1.x allows you to use conditions in a step. If you combine a 'Conditional' step type with a dot command and inline library, you will be able to change the value of a variable and use it in a common library step. For example, a sequence of the steps would need to look like: Step 3 - Component Builds Step 4 - BOM-SAPAdapter - Step type of 'Conditional' - Condition: ${Adapter_Name} eq SAPAdapter - Command Text: .tset env "Adapter_Name=sap" - Inline: A new library that will do the logic that was in BOM step In this case, nothing is added to the 'Else Command' or 'Else Inline' because the step will be skipped if the conditional does not evaluate to true. A new inline library with a step containing the logic that was once in the 'BOM' step needs to be set on each of the conditional steps. Follow the same pattern for each of the values for ${Adapter_Name}, but varying the conditional statement and changing the value of the .tset command in the step. Step 5 - BOM-EmailAdapter .... .... Step x - BOM-FlatFileAdapter - bju |
Hi, Hi, I'm hoping that I understand your project. If so, it seems that you would like to set the value of a variable based off the existing value of a variable. In your project you have an environment at the project level in the pull down, and based off the selection in the pull down, one of the steps needs to change the value based off that value. A way to do this would be to combine a few features of Build Forge. It will require some changes in your project structure. The JPO feature introduced with v7.1.x allows you to use conditions in a step. If you combine a 'Conditional' step type with a dot command and inline library, you will be able to change the value of a variable and use it in a common library step. For example, a sequence of the steps would need to look like: Step 3 - Component Builds Step 4 - BOM-SAPAdapter - Step type of 'Conditional' - Condition: ${Adapter_Name} eq SAPAdapter - Command Text: .tset env "Adapter_Name=sap" - Inline: A new library that will do the logic that was in BOM step In this case, nothing is added to the 'Else Command' or 'Else Inline' because the step will be skipped if the conditional does not evaluate to true. A new inline library with a step containing the logic that was once in the 'BOM' step needs to be set on each of the conditional steps. Follow the same pattern for each of the values for ${Adapter_Name}, but varying the conditional statement and changing the value of the .tset command in the step. Step 5 - BOM-EmailAdapter .... .... Step x - BOM-FlatFileAdapter - bju Thank you very much for the useful information. Is there any way to define the condition one after the other instead defining in every step. For Eg. Step4: Condition : $Adapter_Name=SAPAdapter go to SAP $Adapter_Name=EmailAdapter goto email Command: SAP: .tset env "Adapter_Name=sap" Email:.tset env "Adapter_Name=email" I should able to define all the components in a single step instead of several step for each and every component. Please let me know is there any way do so. Your help is really appreciated. |
I can't think of way exactly as you specified, but another option that is similar would be to use the .runwait -c dot command. This would not use the JPO feature so none of the steps would be 'Conditional' step types.
By using the .runwait command with the -c option, you can conditionally launch a library that will set the environment variable using .tset to the new value for the adaptor type. Then the adaptor specific library can inline a library that does the common task that depends on the new environment variable value. Step 4: Step Type: Regular Command Text: .runwait -c "${Adapter_Type}=SAPAdapter" SAPAdapter_Lib .runwait -c "${Adapter_Type}=EmailAdapter" EmailAdapter_Lib ... ... .runwait -c "${Adapter_Type}=FlatFileAdapter" FailFailAdapter_Lib Then you would need to create a library for each of the adaptor types that sets the environment variable that is required for the specific adapter. The adapter type library will then set the inline chain to a common library that does the common task. Library: SAPAdapter_Lib STEP_1: Command: .tset env "Adapter_Type=sap" Inline: Inline a common library that will perform the common task Library: Common_Lib Command: echo ${Adapter_Type} |
I can't think of way exactly as you specified, but another option that is similar would be to use the .runwait -c dot command. This would not use the JPO feature so none of the steps would be 'Conditional' step types. Thank you very much. It worked But Now I am facing another issue, please help me in getting the issue fixed. As you mentioned Step 4: Step Type: Regular Command Text: .runwait -c "${Adapter_Type}=SAPAdapter" SAPAdapter_Lib .runwait -c "${Adapter_Type}=EmailAdapter" EmailAdapter_Lib ... ... .runwait -c "${Adapter_Type}=FlatFileAdapter" FailFailAdapter_Lib //here , I want to define a path something like .bset env "BOM_Path=A:\J2CA_Components\BOM" Library: SAPAdapter_Lib STEP_1: Command: .tset env "Adapter_Type=sap" Inline: Inline a common library that will perform the common task Library: Common_Lib Command: echo ${Adapter_Type} //I want to add the exact command in Common_lib path like ${BOM_Path}\ConvertNewBom2Old.exe -b bom_j2ca_${Adapter_Type}.txt //I am not able to get the exact BOM_Path value as defined earlier. Please let me know how can this be done. Thanks Veena |
I can't think of way exactly as you specified, but another option that is similar would be to use the .runwait -c dot command. This would not use the JPO feature so none of the steps would be 'Conditional' step types. Thank you very much. It worked But Now I am facing another issue, please help me in getting the issue fixed. As you mentioned Step 4: Step Type: Regular Command Text: .runwait -c "${Adapter_Type}=SAPAdapter" SAPAdapter_Lib .runwait -c "${Adapter_Type}=EmailAdapter" EmailAdapter_Lib ... ... .runwait -c "${Adapter_Type}=FlatFileAdapter" FailFailAdapter_Lib //here , I want to define a path something like .bset env "BOM_Path=A:\J2CA_Components\BOM" Library: SAPAdapter_Lib STEP_1: Command: .tset env "Adapter_Type=sap" Inline: Inline a common library that will perform the common task Library: Common_Lib Command: echo ${Adapter_Type} //I want to add the exact command in Common_lib path like ${BOM_Path}\ConvertNewBom2Old.exe -b bom_j2ca_${Adapter_Type}.txt //I am not able to get the exact BOM_Path value as defined earlier. Please let me know how can this be done. I would like to add , I dont want to define Environment variable here for BOM_Path, because "BOM_Path=A:\J2CA_Components\BOM" is not a constant value it keep on changing according the project in which its called. It needs to be hardcoded inside the step according to the respective project. Thanks Veena |
Hi,
I want to notify the person who has initiated the job instead of entire access group. How can i do this in Build Forge. Please let if now if there are any commands and usage of the command. Thanks Veena |
Hi, Hi Veena, You could use the .email dot command in a step. The syntax would look like the statement below. .email ${BF_USER_EMAIL} Regards, bju |
Hi,
I am using the latest version of the Build Forge. I have created an environment variable TEST of type Pulldown. It contains three options: One=1 Two=2 Three=3 Presently, the default option is Three. Now, I want to change the value of the Option 3 during the job execution using: .set <env_name> "TEST=10". (I want Three to have value 10). I can see the changed value in the current job, but the master copy of the environment remained unchanged. Am I missing something? Will really appreciate if someone can provide me some info. Thanks and regards, Ankit |
Hi, The results seemed reversed. .set updates the master record of the environment. .bset/.tset updates the build copy of the environment. .set <env_name> "TEST=10" Will result in a fourth option being created in the pull down variable named 10 with a value of 10. - Sherard - |
Hi, The results seemed reversed. .set updates the master record of the environment. .bset/.tset updates the build copy of the environment. .set <env_name> "TEST=10" Will result in a fourth option being created in the pull down variable named 10 with a value of 10. - Sherard - Thanks Sherard, I do not see fourth option being created.. And also, I want to change the value of the option that has been selected before starting the project. I have a requirement for which after every run of the project, I will be updating the value of the option selected. Is there any way to do it? Thanks Ankit |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.