Page tree

To read RBA variable values from custom code you must specify which variables you will be reading and then fetch their values and assign them to local VB variables:

    ' --- declare local variables object ---
    Dim variables As Creo.PWS.Automation.BaseDataModel.Variables = action.Variables
    '
    ' --- identify the variables to read ---
    variables.Reading("$prinergyPrimaryServerName")
    variables.Reading("$BookletPageFactor4")
    variables.Reading("$optionAutomaticCoverProcessing")
    '
    ' --- fetch the values ---
    variables.Fetch


    ' --- assign each fetched values to a local variables ---
    Dim Global_prinergyPrimaryServerName As Creo.PWS.Automation.BaseDataModel.ScalarVariable(Of String)
        = variables("$prinergyPrimaryServerName")
    Dim Global_BookletPageFactor4 As Creo.PWS.Automation.BaseDataModel.ScalarVariable(Of Integer)
        = variables("$BookletPageFactor4")
    Dim Global_optionAutomaticCoverProcessing As Creo.PWS.Automation.BaseDataModel.ScalarVariable(Of Boolean)
        = variables("$optionAutomaticCoverProcessing")

To update RBA variables from custom code you must specify which variables are going to be updated, assign values to the variables, and then, if not being done from within a Set Variables action, indicate you are done updating them:

       ' --- declare variables ---
    Dim variables As Creo.PWS.Automation.BaseDataModel.Variables = action.Variables
    '
    ' --- variables to be updated ---
    variables.Updating("@userDefinedErrorMsg")
    variables.Updating("@userDefinedErrorCode")
    variables.Updating("@emailAdministrator")
    '
    ' --- declare each variable being used for the update ---
    Dim Temp_userDefinedErrorMsg As Creo.PWS.Automation.BaseDataModel.ScalarVariable(Of String)
        = variables("@userDefinedErrorMsg")
    Dim Temp_userDefinedErrorCode As Creo.PWS.Automation.BaseDataModel.ScalarVariable(Of Integer)
        = variables("@userDefinedErrorCode")
    Dim Temp_emailAdministrator As Creo.PWS.Automation.BaseDataModel.ScalarVariable(Of Boolean)
        = variables("@emailAdministrator")
    '
    ' --- Update the temporary variable values with appropriate values ---
    Temp_UserDefinedErrorMsg.Value = "Some error message to be reported to the user"
    Temp_userDefinedErrorCode.Value = 4857
    Temp_emailAdministrator.Value = true
    '
    ' --- Signal that you done updating the variables (not required if being done within a Set Variables action) ---
    variables.AccessDone(action.Context.ToString)   

Variables can be read and updated from the same custom code if all the appropriate Reading, Fetch, Updating, and AccessDone calls are made.


  • No labels