9

Someone in the company wants to make one (database) field multiple choice. HOW THE HELL AM I SUPPOSED TO DO THIS

Comments
  • 0
    You mean one field being able to represent two possible types of values?

    (Ex an id which might reference Table A or table B)
  • 0
    @Codex404 one field has multiple possible values, and you could choice as many as you want.

    I don't know if I could do this through programing. It's SAP, so it's complicated, I can't really programm most things. Might have to choose other fields instead
  • 2
    bit-field?
    you can store up to 64 yes no choices in an unsigned
  • 0
    @groenkek that could have worked, if the field wasn't char2. FFS it keeps getting worse
  • 3
    @cantthinkofone I would link it to a multiple choice table and then make it a relationship (one to many or many to many depending on the data)
  • 0
    Change the schema?
  • 0
    @NotWhoIUsedToBe the table schema? I can't, it's SAP, I can't touch anything
  • 0
    @Codex404 I'll see if I can do that. We try to avoid making tables (again, SAP, we can't do anything) but that might be the best solution, at least at the moment
  • 0
    @cantthinkofone otherwise you could make it even dirtier by placing semicolons between values and split it later.
  • 0
    Comma separate the values maybe?
  • 1
    @Codex404 @karma I thought about that actually, but each option id has 2 digits and the field is char2, and I can't change it.
    I also don't know if I could change the code and separate them, since it's a standard transaction and we rarely can change those.
  • 0
    I have never worked with sap, but my boss one told me that you can change (almost) everything in sap.
    Maybe you explore some paths deep in the sap/abap hell...
  • 3
    @TobyAsE I mean, I could change the field type and some source code, but then when they update it and it doesn't work it's my fault and I don't want that.

    That's why we avoid changing anything they did and only make our own transactions. You change one tiny thing everything stops working
  • 0
    @cantthinkofone and that’s why you should use proper git flow.
  • 1
    @cantthinkofone ah I see ... Complex!
  • 2
    @Stebner55 it's SAP, I don't think I can use git for that 😂
  • 0
    Store the first value in the field and all extra values in a one-to-many related table. That'd be the best option.

    Now, if you can't change anything and they still expect you to make the field multivalued out of thin air, I'd say you'll have a lot of explaining ahead of you. 😉
  • 2
    @ethernetzero actually, just a couple of hours ago we talked about this and we decided we will be creating a field for each choice. Each field could only have one of two values: 'X' or empty. We have a few fields like that in the same table, so we'll just copy them. I suggested the 'creating a table' option that someone had already suggested, but then we would have to change some of the source code, it would be a mess.

    Maybe it's not the best solution, because the values could change, but it's the best we can do with all the limitations we have.
Add Comment