10 Replies Latest reply on Dec 4, 2011 2:05 AM by VesaPakarinen

    Problems with two tables



      Problems with two tables


      I believe that there is a simple solution to my problem. I am trying to calculate between fields with two tables and bring fields in one layout.


      field stockID (type text)

      field GroupName (type calculation)

      field Jname (text)


      field stockID

      field GroupName

      field Jname (text)

      I need to calculate fields from table_1 to table_2 like {table_1::GroupName &"en"} and bring values to same layout. I tried with relationships. I made field PrimaryKey with autoenter option and linked it to PrimaryKey field to an other table. But the fields are empty???


      Help needed. Thanks

      Regards, Vepakari

        • 1. Re: Problems with two tables

          How do the tables differ from each other? (You list exactly the same fields for both tables and this seems a bit unusual.)

          What is the purpose of each table?

          Can you post an example of what you want to see on the screen? (can't really understand what you have described here.)

          • 2. Re: Problems with two tables


            I need to get three different csv -file exported. I didn´t mentioned that there is more field in these tables. Table_1 is the main table where csv-data will be imported. Table_2 and Table_3 is "language" tables where fields data will be calculated or formulated from table_1. Exported csv files must have same header so I think over to resolve this with three different table. And part of tables files must be visible in same layout. 


            Sorry my obscurity.

            • 3. Re: Problems with two tables

              Does StockID uniquely identify each record? (making it a primary key?)

              If so, then you do not need the GroupName and JName fields in Table 2, unless you plan to change the data after import without modifying the original data imported into Table_1. Any time that you need the GroupName and JName data, you can refer to the fields in Table_1--both for calculations, and for export back into csv files.

              This relationship:

              Table_1::StockID = Table_2::StockID

              Should be all that is needed to link a record in Table_2 to a record in Table_1.

              No records in Table_2 will be created, however, unless you create them, either by importing data into table_2 or with a script that creates records with matching StockID values in that table.

              That is the best I can do from what you have posted so far. I believe you are translating your posts into English from another language. Unfortunately, it appears that some of the meaning of what you are trying to say is being lost in that translation.

              • 4. Re: Problems with two tables

                StockID is not uniquely. if I make field named StockPre in these three tables. Table_1 with autoenter serial. Must StockPre field be autoentering too in Table_2 and Table_3 field?

                • 5. Re: Problems with two tables

                  Without a unique identifier, how can you match a record in table_2 to a record in table_1. This is best done with a primary key, but sometimes can be done by matching more than one pair of fields if the data combined in the fields will uniquely identify the records.

                  Please keep in mind that I really don't know yest what exactly you need to do with the data in these other tables nor why.

                  • 6. Re: Problems with two tables

                    Ok. The main thing is that I must generate from table_1 two tables (table_2and table_3). Part of field values are same and part must be generate in tables2 and 3. I import csv data to table_1 with autoenter option. This is basic data. 


                    • 7. Re: Problems with two tables

                      Which still leaves table_2 and table_3 empty. If records in these tables must be linked to specific records in table_1, there must be a field in table_1 with a value that uniquely identifies each record that you can use to define a relationship linking these tables to table_1.

                      If you generate that ID with an auto-entered serial number field in Table_1 during the import by enabling the auto-enter option you are part way there. But you still need to create records in the other two tables.

                      You could:

                      1. Use import records to copy the ID field and other selected fields into the other two tables. You can perform finds on Table_1 first if you only want selected records copied over or import records can copy the entire table.
                      2. Scripts can loop through all or some records in Table_1, creating records with matching IDs and moving other selected data while doing so.
                      • 8. Re: Problems with two tables

                        Thanks again. This advice seems working. How I can import entire table, as you mentoned ? (as a script)

                        • 9. Re: Problems with two tables

                          Aargh. I am little bit stupid or ?. 

                          If I perform find script on  Table_1 what is syntax? 

                          Enter Find Mode []
                          Set Field [Table_1 ; SEARCH CRITERIA How i get all records ?]
                          Perform Find []

                          And to import

                          Perform Script [“Find Records Script” from file: “Table_1”]
                          Import Records [No dialog, "Table_1"]

                          Or must it be loop?

                          • 10. Re: Problems with two tables



                            I resolve problem. I don´t make more tables. In Table_1 is add more fields like Jname_fi, Jname_en, Jname_ru. When data will exported, loop script set variable to Jname, what is header of exported csv.

                            Thanks a lot PhilModJunk. That´s true that you must know what are you doing :-)