No announcement yet.

Select field and other fields related

  • Filter
  • Time
  • Show
Clear All
new posts

  • Select field and other fields related

    Hello, i am trying create fields in the localhost host database and successfully used database builder to create few fields like text (varchart), enum, date..etc

    now 1- when i come to sc building, open the filed to change properties, i see this field descirbed as "TEXT" while it is "enum" in db with its pre-defined values for the select values..

    2- hence, i am not able to display the values i created with the database enum field

    is it better to create fields from phpmyadmin or from sc database builder?

    what is the difference of creating a field in the database and creating it from sc > create new field, and if it is not in the db, then how the data will be stored? where?

    in form application, if you create a field in database builder, go to application, synchornize db, you will have the fields added to application, but in grid application there is not such option as the sycnhonirze db fields, so how i can add new fields that i created in the database? show i always create a new grid application to have the newly added fields to it??

  • #2
    The enum field is a text field. the constraint will check that the value is within the range of the specified items. That's something different than to look at it from the outside. If you need to have the predefined values you need to set the the field type to 'select' and apply sql to select the values or set the values to manual and add them yourself. It doesn't matter which tool you use to maintain your database. phpMyAdmin is very good for mysql and if you deploy your application you need it to copy your database structure anyway. But I use the database builder too as well as other tools, it depends. If you create a manual field in SC than this is a 'free' field. You can do with it what you like, but it is *not* bound to a field in the database. You use it to show calculated data for instance.
    The grid cannot synchronize, you need to change the sql statement manually. On more complex queries you can use sql builder and cut/paste from there.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development /


    • #3
      thanks Albert,

      then i can just create all as varchart initially in phpmyadmin then play with the field with SC and change the field into int, text, date, select, that is fine right?

      also, if i can't synchronize the grid, (i still wounder why) then i have to create a new grid each time i have a new field!? it is not practical to change the sql statement manually, i prefer to delete and re-create a new grid app instead, what you think?

      one more question, if i want to make simple grid and to show each raw a pincle icon to edit that row in a form format, do i need to create a form and associate it with the gird or no need? (another workaround)?


      • #4
        Just use the basic fieldtypes like integer, number, (var)char etc. You can use enum's but as said that's just a constraint type within the db.
        I don't know either why you can't synchronize a grid, it just is. I think it has to do with the fact that grids useually can contain more than data from one table. But it's not a big deal actually.
        If you want a pencil then you can create a form of type editable grid. Depending on a checkbox you are able to popup a modal form or to edit inline. You can also use an application link. Then you need a form and a grid. Within the grid you create an applicationlink to the form using the main key.
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development /


        • #5
          OK Albert, then it is fine if i create all my fields in table initially as varchart then control the rest with sc, no need to customize them all asa int, enum, varchart in the db then again define each one as i want in sc,,,,

          so if i want to add new field to grid that is already in db and used in sc form (after cysnchorniing its table) how i can add it to grid? what is the sql statement used here?
          also, if i can get grid from different tables then how i can do that? because it is interesting

          well, i know this might look amateurish for you dear, but because i am new to sc then i am trying all functions here whish it is okay for you dude

          appreciated your time and efforts



          • #6
            You can add a new field to a grid to go to the sql section where the select ... from.... is presented. Add your field there and hit save. It will add the field. If you need fields from different tables into one grid you need to create an appropiate select statement to attach tables. You need to dive a bit into the sql something like

            select a.field1, a.field2, b.field1, b.field 2 from tablea a, tableb b where a.field1=b.field1.

            YOu need to use your tablenames and fields of course. But try to find some primers on sql on the web to get a basic feeling.
            Albert Drent
            aducom software netherlands
            scriptcase partner, reseller, support and (turn-key) development


            • #7
              For complex SQL statements, there is an awesome tool that will make your job easy, from SC menu : Tools => SQL builder.
              Scriptcase V8.1 Enterprise Edition.