Announcement

Collapse
No announcement yet.

sc_field_style macro does not accept variable

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • sc_field_style macro does not accept variable

    I have a problem that the sc_field_style macro does not accept variable:

    I use this in the OnRecord event on Grid app:

    This works, but set all records to the specified colour, as expected:

    Code:
    sc_field_style({task_status}, '#ff0a0a' );


    This does not work:

    With single quotes:


    Code:
    $get_col = "SELECT colour_code from tbl_task_status where ID = {task_status}";
    sc_lookup(rs_col, $get_col);
    $bg_col= "'" .{rs_col[0][0]}."'"; // add single quotes
    echo $bg_col;   //this returns the correct colour code
    sc_field_style({task_status},$bg_col);


    Without single quotes:

    Code:
    $get_col = "SELECT colour_code from tbl_task_status where ID = {task_status}";
    sc_lookup(rs_col, $get_col);
    $bg_col= {rs_col[0][0]}; // add single quotes
    echo $bg_col;   //this returns the correct colour code
    sc_field_style({task_status},$bg_col);
    any idea how I could change the bg color on individual rows within the grid, based on the value of the field?

  • #2
    Hello,

    Issue reported to our bugs team.

    regards,
    Bernhard Bernsmann

    Comment


    • #3
      Solution

      Originally posted by symanix View Post
      I have a problem that the sc_field_style macro does not accept variable:

      I use this in the OnRecord event on Grid app:

      This works, but set all records to the specified colour, as expected:

      Code:
      sc_field_style({task_status}, '#ff0a0a' );


      This does not work:

      With single quotes:


      Code:
      $get_col = "SELECT colour_code from tbl_task_status where ID = {task_status}";
      sc_lookup(rs_col, $get_col);
      $bg_col= "'" .{rs_col[0][0]}."'"; // add single quotes
      echo $bg_col;   //this returns the correct colour code
      sc_field_style({task_status},$bg_col);


      Without single quotes:

      Code:
      $get_col = "SELECT colour_code from tbl_task_status where ID = {task_status}";
      sc_lookup(rs_col, $get_col);
      $bg_col= {rs_col[0][0]}; // add single quotes
      echo $bg_col;   //this returns the correct colour code
      sc_field_style({task_status},$bg_col);
      any idea how I could change the bg color on individual rows within the grid, based on the value of the field?
      Same problem, but try this, works for me:

      Code:
      $get_col = "SELECT colour_code from tbl_task_status where ID = {task_status}";
      sc_lookup(rs_col, $get_col);
      [bg_col]= {rs_col[0][0]}; // add single quotes
      echo [bg_col];   //this returns the correct colour code
      sc_field_style({task_status},[bg_col]);

      Use Global varible. :P

      Comment


      • #4
        I am still seeing this same bug in SC version 8.00.0045.

        Specifically, the macro sc_field_style will not accept the second parameter (it is the background color) as a {field} or $local variable. It will accept it as just putting in a quoted hex code like '#a12a12' OR even as a [global] value.

        So angelIrad's work around still works, but this should be fixed so that a field value or local variable works too.

        Comment


        • #5
          Just curiousity.
          var_dump of var results to '#ff0a0a' or 'ff0a0a'?
          /Giuseppe

          Professional Scriptcase Services
          Some Customers opinions

          Comment

          Working...
          X