BBC.SHARED.JOBI.CONVERT-PROMPTSET-FIELDS

Summary

Object type
JOBI
Object Folder
PACKAGES/BEST-BLU/BBC.SHARED/SOURCE
Title
Convert promptset fields value to a “machine value”
Archive Key 1
-
Archive Key 2
-
Created
WRITER/B4A am: 2022-06-30 13:11:42
Last Modified
WRITER/B4A am: 2024-01-09 09:57:40 9 x
Last Used
-

Description

Converts displayed value to input values hat are easier to handle in code

This include can only be used for promptset fields hat do have a data reference. All promptsets linked to the object will be processed.

All names of promptset variables that start with “V$” will be converted. All other variables will not be touched. The converted value will be stored in a new variable that misses the prefix “V$” and instead has a prefix “C$”

Note: This include requires at least one of the following versions

  • 12.2.8
  • 12.3.8
  • 21.0.0

Example

  • &V$UPDATE_PACKAGE_I# -> The converted value will be saved in the variable &C$UPDATE_PACKAGE_I#
  • &UPDATE_KZ_I# -> will not be converted

The converted value will be read from the data reference variable. While the promptset displays the first value the new value is read from the key of the same entry.

Example

Variable

&V$UPDATE_PACKAGE_I#

Data Reference Variable

Key Value 1
Y Yes
N No

The variable &V$UPDATE_PACKAGE_I# will have the value “Yes” when the PromptSet is submitted. The include will generated the variable &C$UPDATE_PACKAGE_I# containing the value “Y”

Parameter

Input

Output

Example

:include BBC.SHARED.JOBI.CONVERT-PROMPTSET-FIELDS

Process

:set &PRPT_LIST_HND# = prep_process_var("BBC.SHARED.VARA@SEC_SQLI.GET-PROMPTSETS-OF-OBJECT")

:process &PRPT_LIST_HND#
:  set &PromptSet_Name# = get_process_line(&PRPT_LIST_HND#,1)
:  print " --- check Parameter for Promptset:&PromptSet_Name#"
!
:  set &PRPT_HND# = prep_process_promptset (&PromptSet_Name#)
:  process &PRPT_HND#
:   set &prompt_Variable_Name# = get_process_line(&PRPT_HND#,1)
:   set &prompt_Variable_Type# = get_process_line(&PRPT_HND#,4)
:   if &prompt_Variable_Type# = 'label'
:   else ! of &prompt_Variable_Type# = 'label'
:     set &prompt_VALUE# = get_script_var(&prompt_Variable_Name#)

:     set &is_to_convert# = str_match(&prompt_Variable_Name#,"V$*")
:     if &is_to_convert# = 'Y'
:        set &var_name# = substr( &prompt_Variable_Name#,3)
:        set &prompt_VARA_Name# = get_process_line(&PRPT_HND#,5)
:        set &VARA_HND#=prep_process_var(&prompt_VARA_Name#)
:        process &VARA_HND#
:          set &vara_value#  = get_process_line(&VARA_HND#,2)
:          if &vara_value# = &prompt_VALUE#
:            set &vara_key#  = get_process_line(&VARA_HND#,1)
:            if &vara_key# = "<2spaces>"
:              set &vara_key# = "  "
:            endif
:            if &vara_key# = "<space>"
:              set &vara_key# = " "
:            endif
:            print "  generating: C$&var_name# --> &vara_key#"
:            set &temp# = "&vara_key#"
:            publish &temp#, "C$&var_name#", TASK
:        endif
:        endprocess &VARA_HND#
:        close_process &VARA_HND#
!
:     else
:        print "  do not convert  &prompt_Variable_Name#-->&prompt_VALUE#"
:     endif
:   endif
:  endprocess &PRPT_HND#
:  close_process &PRPT_HND#
!
:endprocess &PRPT_LIST_HND#
:close_process &PRPT_LIST_HND#