Conditional apply suffix to col_value_set

(6 posts) (2 voices)
  1. nsepetys, Member

    Hello myDBR Representative,

    How are things going? I am trying to apply formatting to an editable crosstab column. The trick is that the formatting is conditional. I have managed to get it to correctly show the conditional formatting when the crosstab table loads (and refreshes) but when a user inputs a new value or updates a value it is returned without the appropriate formatting.

    The value column has some values that need to be percents and I was wondering if it's possible to conditionalize the "suffix" parameter of the col_value_set function? I would like to conditionally apply append a "%" to the value column (column C) of the column B type (which for simplicity shows either "Percent" or "Number"). I would like column C to append the "%" when column B is "Percent" and not when it is "Number".

    Do you have a method for implementing this conditional suffix logic?

    Thanks,
    Noah

    PS: I just noticed the col_value_text function. I imagine I can theoretically apply the conditional formatting in my insert/update function for the editable column and return the suffix there but I'm guessing the returned value wouldn't be implicitly converted to a numeric value. Do you concur? If that's the case it isn't preferred for sorting/export reasons and I'd be looking for another solution.

  2. myDBR Team, Key Master

    Noah,
    you can set the conditional formatting with dbr.cellformat. myDBR will format the user input with the cell's formatting if you just return the user value from the editing report. That is all you need to do.

    --
    myDBR Team

  3. nsepetys, Member

    That what I initially expected but it doesn't seem to be working that way. If you need to replicate your editable crosstab looks like a good candidate for my scenario. Just need to conditionally apply a percent format to one column's cells and you'll be looking at pretty much what I have.

  4. myDBR Team, Key Master

    Noah,
    here is an example how to use the dir.cellformat.

    --
    myDBR Team

  5. nsepetys, Member

    I was doing pretty much the same thing on my end. I am emailing you guys the data behind my primary proc.

  6. nsepetys, Member

    For all who care to know- it turns out I was using a return from my update/insert procedure that included an explicit json string (which was the issue). I stripped the json string and did a straight return of the data and the conditional format works using
    SELECT 'dbr.cellformat', 'cellvalue','format'; (where cell value has my number/percent and format has the condition logic that returns either "%d %" or "%d" based on the whether the value of another column).


Reply

You must log in to post.