Continuation line within Dependency php file

I have a Dependency file using SetOptions to present a DD List.  The reason I am using a Dependency file is there is more than one conditions involved so my understanding is I can't build a Dependent Dropdown list within Studio as that only allows one 'parent'

The DD List is quite verbose and it is critical that I get the key values and label values aligned, otherwise the incorrect key will go into the database.

To make the file more readable so that maintenance is accurate, I'd like to break the label options into different lines. I'm not a php guru so am wondering which syntax I can use as a line break. I've tried the ; as shown below but this does not appear to work. The QRR succeeds but the DD list is not presenting.

Original: (labels actually are on one line)

$dependencies['RevenueLineItems']['setoption_dep_Attest2020'] = array(
'hooks' => array("edit","save"),
// 'trigger' => 'true',
'trigger' => 'and(equal($sym_service_line_c, "1"), equal($sym_adv_std_year_c, "2020"))',
'triggerFields' => array('sym_adv_std_year_c', 'sym_service_line_c'),
'onload' => true,
'actions' => array(
array(
'name' => 'SetOptions',
'params' => array(
'target' => 'sym_adv_std_matter_c',
'keys' => 'createList("", "19", "2", "9", "5", "11", "10", "4", "8", "12", "3", "7", "6", "15", "16", "17", "18", "100", "101", "21", "20", "13", "14", "99")',
'labels' => 'createList("blank", "Label A", "Label B", "Label C", "Label D", "Label E", "Label F", "Label G", "Label H", "Label I", "Label J", "Label K", "Label L", "Label M", "Label N", "Label O", "Label P", "Label Q", "Label R", "Label S", "Label T", "Label U", "Label V", "Label W")'
),
),
),
);

Revised : (line breaks)

$dependencies['RevenueLineItems']['setoption_dep_Attest2020'] = array(
'hooks' => array("edit","save"),
// 'trigger' => 'true',
'trigger' => 'and(equal($sym_service_line_c, "1"), equal($sym_adv_std_year_c, "2020"))',
'triggerFields' => array('sym_adv_std_year_c', 'sym_service_line_c'),
'onload' => true,
'actions' => array(
array(
'name' => 'SetOptions',
'params' => array(
'target' => 'sym_adv_std_matter_c',
'keys' => 'createList("", "19", "2", "9", "5", "11", "10", "4", "8", "12", "3", "7", "6", "15", "16", "17", "18", "100", "101", "21", "20", "13", "14", "99")',
'labels' => 'createList(;
"blank",;
"Label A",;
"Label B",;
"Label C",;
"Label D",;
"Label E",;
"Label F",;
"Label G",;
"Label H,;
"Label I",;
"Label J",;
"Label K",;
"Label L",;
"Label M",;
"Label N",;
"Label O",;
"Label P",;
"Label Q",;
"Label R",;
"Label S",;
"Label T",;
"Label U",;
"Label V",;
"Label W")'
),
),
),
);


Thank you

Parents
  • PHP will accept line breaks within a string and If I'm not mistaken, SugarLogic will usually ignore whitespace and newline characters, therefore

    'labels' => 'createList(
      "blank",
      "Label A",
      "Label B",
      "Label C",
      "etc."
    ',
    


    should work.


    If you want to avoid any line breaks in the resulting string, you could instead concatenate separate strings using the . character:

    'labels' => 'createList('
      . '"blank",'
      . '"Label A",'
      . '"Label B",'
      . '"Label C",'
      . '"etc."'
    . ')';


    or

    'labels' => 'createList(' .
      '"blank",' .
      '"Label A",' .
      '"Label B",' .
      '"Label C",' .
      '"etc."' .
    ')';

    if you find that prettier.

Reply
  • PHP will accept line breaks within a string and If I'm not mistaken, SugarLogic will usually ignore whitespace and newline characters, therefore

    'labels' => 'createList(
      "blank",
      "Label A",
      "Label B",
      "Label C",
      "etc."
    ',
    


    should work.


    If you want to avoid any line breaks in the resulting string, you could instead concatenate separate strings using the . character:

    'labels' => 'createList('
      . '"blank",'
      . '"Label A",'
      . '"Label B",'
      . '"Label C",'
      . '"etc."'
    . ')';


    or

    'labels' => 'createList(' .
      '"blank",' .
      '"Label A",' .
      '"Label B",' .
      '"Label C",' .
      '"etc."' .
    ')';

    if you find that prettier.

Children
No Data