No announcement yet.

select problem

  • Filter
  • Time
  • Show
Clear All
new posts

  • select problem

    silly question but being new to scriptcase
    I have a table (records) that has a field called category_id
    I have a seond table called category that has category_id and Category_name fields
    When I add a new record to the records table I look up the category by category name by a drop down list from the category table
    How do I pass the category_id to the records table

  • #2
    This is very basic stuff johneb - have you checked out the many example short videos that cover most things like this on the scriptcase website? It is the best way to get a handle on doing most things in SC especially the basics like you are asking. Also you don't really say what you have already set up in SC to do this, just how the backend database is set up. Are you using form apps, grid apps, are you using application links or the built in links...? If that last sentence makes little sense to you then you need to at least learn the basics before coming here - not least of all because answers you get on here will force you to have to read up and do the basic learning in order make sense of them. Of course anything you read / watch that doesn't make sense is a reasonable question to put to this forum.

    Now, whilst you can easily pass parameters between SC apps and into tables etc, SC manages / hides much of this basic stuff for you so you don't need to get to that level (I suspect what you have set up is actually over-engineering something SC will do "out of the box" - my apologies if I'm mistaken). Again, probably because you have made assumptions on how SC works without doing the initial learning (I'm guessing you have used a different tool in the past?).

    Of course once you start to get familiar with SC you will want to do some things differently to the default - which SC fully allows. But I suggest you get used to the basics of SC first (initially a steep learning curve, but not a long one). It will then become more obvious what you should do re your question. If you are still stuck, then come back here.

    (A gentle bit of constructive criticism: most people on here - including me - are happy to help others on here where we can. The "cost" is that the requestor has to have shown that they have generally at least attempted to work it out themselves.)

    Now, after all that - if I have got it all wrong, my apologies. In which case you need to supply more details about what you have set up so far (as mentioned above, e.g. what forms, grids, links, any event code, plus screenshots where relevant etc)


    • #3
      Hi adz1111 Thank you for your reply
      You have made some assumptions
      Some are correct
      You are right in saying I have comefrom a different tool
      I have extensive experience in desktop data base applications
      I have a normalised data base of some 50 odd tables
      To get a handle on SC I have started out with two files
      Anglers and Categorys
      I have created an SC form that populates the Angler table.
      The Angler table includes a field category_id
      I have created a lookup field in the form where the user can pick from a list of names from the category table
      What I am trying to do is pass the id associated with the category name to the angler table "angler:category_id"
      Category_name = "male"
      Category_id = "1"
      Category_name ="Female"
      Category_id = "2"

      Angler_Name = "joe Bloggs"
      Angler_category_id = "1"
      Angler_name ="Nancy Bloggs"
      Angler_category_id = "2"

      Very basic stuff

      But I cannot understand. with the SC form, that populates the Angler table and looks up the Category Name from the Category Table how to pass the Category_id assocoiated with the Category_name to the Anglers table.

      It seems I think from looking at SC tutorials that this is possible with Ajax
      Surely there must be a simpler way

      It is really just "angle_category_id = category_category_id"

      If anyone can point me to a SC tutorial the explains passing information between related data base files I would be mot gratefull

      This isnt rocket science but a very simple basic question
      Last edited by johneb; 05-08-2015, 09:49 PM.


      • #4
        Ok - that's clearer.

        I may be missing something, but if you have a lookup set up correctly on that field in the form, then the ID should be what gets stored in the database naturally when someone picks the name from the dropdown?

        So when you say lookup what do you mean?

        What should be setup is.... in the form - on the field that is to show the Category names (angler_category_id?) - on the right, the data type of the field should be "select".

        A bit further down is a section called lookup settings. The Lookup Method should be set as Automatic.

        Click the Create Select link. Choose your Category table, and the key field (category_id). Then choose "Field", and the field to displayed (Category_name). Click the tick mark and the SQL required is put in the SQL Statement box.

        That's it.
        Last edited by adz1111; 05-09-2015, 07:58 AM.


        • #5
          adz1111 if you were here i would kiss you
          i have spent hours on this
          i was doing, i thought, exactly what you have suggested but the category_id in the angler_table populated from a drop down from the category table always came up as null
          after reading your post i eventually deleted the form and started over
          bugger me it worked Yahoo !!
          still do not know what I had wrong but something obviously
          without people like you this can be a very lonely place
          thanks heaps
          Last edited by johneb; 05-09-2015, 10:21 PM.


          • #6
            Glad it helped :-)