Announcement

Collapse
No announcement yet.

Form field checkbox lookup multiple value (position) recorded wrong in sql database

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

  • Form field checkbox lookup multiple value (position) recorded wrong in sql database

    I've created a checkbox field from a varchar field where the data is a 12 character string composed of 0 and 1 (1 = checked).First I've created the checkbox field with a multiple values (delimitor) as lookup, then change it to multiple values (position) as it was more appropriate for what I need to do. My problem is that now when I open the form, the field is showing the 12 checkbox correctly but when I submit the form, that field is stored wrongly in the mysql database. if all the checkbox are checked then the data in sql should be "111111111111" but instead it is stored as "1;1;1;1;1;1;" so when I open the form again instead of 12 checked box I have the odd box checked and the even box unchecked. Look like the form is showing the field as multiple value (position) but the data is stored as multiple value (deimitor) as it was the first choice I made when created the field lookup. Now there is no way to get rid of that. Remove the field form the form and redo it but still the same problem. Change the field to text field which work find (I was able to put back the "111111111111" but when I go back to checkbox field with multiple value (position) lookup I still have the "1;1;1;1;1;1;" when I submit the form. Any idea apreciated as I'm stuck in my development

  • #2
    This is not a bug imho. If you use a multi select then the keyvalues of the select are stored delimited by ';'. That's default behaviour. SC will explode the fields to process the right checkboxes to be checked. You cannot change that behaviour. To be able to use this type of field correctly you must use a textfield of sufficient length.
    If you need this data elsewhere in your application then you must explode the field yourself and process.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Sorry but you didn't read your web help. There is two type of Multiple values checkbox.
      The Multiple values (delimiter) which is what you describe as 1;1;1;1;1; values delimited by ;
      and the Multiple values (Position) where there is no delimiter (no . The values are not delimited by ; but instead we need to tell SC the position number and the lenght of the data we need to separate to each checkbox. for example I've put position 1 lenght 1, position 2 lenght 1, position 3 lenght 1 etc. that should give me a sql field of 111111111111, without ; separator and 12 checkbox on the form.
      My problem is that I'm using the later Multiple values (Position), no delimiter, but scriptcase is storing it as Multiple values (delimiter) with ; separator and that way I'll need a 24 character long sql field .

      also when I reopen the form SC is splitting the 1;1;1;1;1;1; sql value correctly and showing 1_1_1_1_1_1_. If it would be a Multiple values (delimiter) field it would end up with 111111______ (filling only the first 6 checkbox) as the ; delimiter are not taking place of a checkbox in the Multiple values (delimiter).

      So if I have two possibility in SC, Multiple values (delimiter) and Multiple values (position) for me it's a bug because SC is handling only the first possibility. There is no way to use Multiple values (position) even if it is described in the web help as another possibility

      So tell me how to use it, without delimiter, or report it as a bug

      Comment


      • #4
        mmmm, I haven't used/experience second possibility. Then it looks like a bug. But I'm not an employee of SC so I will not be able to push this to the develpment team. Bartho?
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development
        www.scriptcase.eu / www.scriptcase.nl

        Comment


        • #5
          Ok didn' know that you were not from SC. Hope they monitor that forum. I'll open a ticket Thank you

          Comment


          • #6
            Hello,

            I'm not sure if that is a bug.

            I have reported this issue to our bugs team for further testing.

            A tip so you won't get stuck on this error is that you can remove those delimiters using str_replace on the onValidate() or onValidateSuccess().

            regards,
            Bernhard Bernsmann

            Comment


            • #7
              Hi, It's getting worst as I tried to see what was the field value before I try to remove the ;
              in the onbeforeupdate event I've added sc_alert({field}); to see what is in there before any manipulation to remove the ;
              In all 12 checkbox, in the lookup edition I've set the value = 1 and the negative value = 2. That mean if the 12 checkbox are checked then the resulting value in the alert popup should be 1;1;1;1;1;1;1;1;1;1;1;1
              If I have only the even checkbox checked then I should have in the alert 1;2;1;2;1;2;1;2;1;2;1;2
              the alert show 1;1;1;1;1;1Hi, It's getting worst as I tried to see what was the field value before I try to remove the ";"
              in the onbeforeupdate event I've added sc_alert({field}); to see what is in there before any manipulation to remove the ";"
              In all 12 checkbox, in the lookup edition I've set the value = 1 and the negative value = 2. That mean if the 12 checkbox are checked then the resulting value in the alert popup should be 1;1;1;1;1;1;1;1;1;1;1;1
              If I have only the odd checkbox checked then I should have in the alert 1;2;1;2;1;2;1;2;1;2;1;2
              but the alert show 1;1;1;1;1;1 all the unchecked value are missing so when I reopen the form I endup with the first six checkbox checked and the last six unchecked which was not the result wanted.
              so it is not just how to remove the ";" that should not be there. It's the Multiple Values (Position) that is not working as it do not add the negative value so it is not possible to get consistent data saved. So I've reported it as a bug and hope that it will be solved soon

              Comment


              • #8
                Sorry something went wrong with my last post so I send it again

                Hi, It's getting worst as I tried to see what was the field value before I try to remove the ";"
                in the onbeforeupdate event I've added sc_alert({field}); to see what is in there before any manipulation to remove the ";"
                In all 12 checkbox, in the lookup edition I've set the value = 1 and the negative value = 2. That mean if the 12 checkbox are checked then the resulting value in the alert popup should be 1;1;1;1;1;1;1;1;1;1;1;1
                If I have only the odd checkbox checked then I should have in the alert 1;2;1;2;1;2;1;2;1;2;1;2
                but the alert show 1;1;1;1;1;1 all the unchecked value are missing so when I reopen the form I endup with the first six checkbox checked and the last six unchecked which was not the result wanted.
                so it is not just how to remove the ";" that should not be there. It's the Multiple Values (Position) that is not working as it do not add the negative value so it is not possible to get consistent data saved. So I've reported it as a bug and hope that it will be solved soon

                Comment

                Working...
                X