7 Replies Latest reply on Jan 16, 2012 11:02 AM by philmodjunk

    Script problems

    enversucek_1

      Title

      Script problems

      Post

       Hello I have problem to write script in screenshot you can see grean zone and there I have 4 columns in one row and i must write scrit to open me new row with another 4 columns and later again  and another. Also in yellow zone there is number 1 when will be open another row should be number 2 and later 3 etc. but layaut id can not grow up (2/35)  can somebody help me with this Thank You 

      example_layout.jpg

        • 1. Re: Script problems
          philmodjunk

          Is the green zone a portal to a related table?

          If so the yellow zone cannot be updated to show the count of these related records as it reports the number of records in the layout's table, not those of the portal.

          If you can confirm that this is a portal, I can give you a script that creates a new related record in the portal table to add the additional row for you.

          • 2. Re: Script problems
            enversucek_1

             

            Hi yes green zone is portal. I have one script but with my table do not workin I spend with this much time and I cant fixed if I will send you all file maybe you can look and tell me where is the problem Can you give me your email. Thanks
            • 3. Re: Script problems
              philmodjunk

              The following script will create a new record that appears in your portal. I do not know the names of fields and tables in your file, so you will need to substitute your names for mine.

              You will have a relationship for your portal:

              LayoutTable::PrimaryKey = PortalTable::ForeignKey

              This script creates a new related record in Portal Table:

              Freeze Window
              Set Variable [$ID ; Value; LayoutTable::PrimaryKey ]
              Go to Layout [PortalTable ( PortalTable) ] //any layout that lists "PortalTable" in show records from in layout setup will work.
              New Record/Request
              Set Field [PortalTable::ForeignKey ; $ID ]
              Go To Layout [original table]

              Note that it is also possible to enable "Allow creation of records via this relationship" for the portal table in the relationship and then you can add new related records simply by entering data into the bottom blank row of your portal.

              • 4. Re: Script problems
                enversucek_1

                 Thank You but in my program this is not working I think maybe İ have somewhere else problem.

                • 5. Re: Script problems
                  philmodjunk

                  What problems are you encountering when you attempt this method? If you tell me how it failed for you, that description may tell me what to suggest differently or to explain in greater detail.

                  • 6. Re: Script problems
                    enversucek_1

                     Allow User Abort [Off]

                    Set Variable [$Kayıt No: Value: Kontrol::Kayıt NO]

                    Freeze Window Go to Layout ["Hasta Kabul" (Hasta kabul)]

                    Go to Object [Object Name:Kontrol::Kayıt No]

                    Go to Portal Row [Select First]

                    Set Variable[$Kayıt No:Value:Kontrol::Kayıt No]

                    Go to Portal Row [Select ;Next;Exit after last]

                    New Record/Requests

                    Set Field[Kontrol::Kayıt No;Kontrol::Kayıt No]

                    Commit Records/Requests [Skip data entry validation:No dialog]

                    Go to Layout[orginal layout]

                    Set Field [Muayene::Şikayeti:$$Şikayeti]

                     Set Field [Muayene::Muayene Bulguları;$$Muayene Bulguları]

                    Set Field [Muayene::Hikayesi;$$Hikayesi]

                    Set Field [Muayene:Plan;$$Plan]

                    Set Field [Muayene:TANI 1;$$TANI 1]

                    Set Field [Muayene:TANI 2;$$TANI 2]

                    Set Field [Muayene:Boy;$$Boy]

                    Set Field [Muayene:Kilo;$$Kilo]

                    Set Field [Muayene:Tansiyon Büyük;$$Tansiyon Büyük]

                    Set Field [Muayene:Tansiyon Küçük;$$Tansiyon Büyük]

                    Set Field [Muayene:Ateş;$$Ateş]

                    Set Field [Muayene:Nabıx;$$Nabız]

                    Set Field [Muayene:Baş Çevresi;$$Baş Çevresi]

                    Set Field [Muayene:Divabet Hastası;$$Divabet Hastası]

                    Set Field [Muayene:Omuz Muayene Testleri;$$Omuz Muayene Testleri]

                    Set Field [Muayene:Kalça Muayene Testleri;$$Kalça Muayene Testleri]

                    Set Field [Muayene:Diz Muayene Testleri;$$Diz Muayene Testleri]

                    GO to Field[Kontrol::Muayene Tipi]

                    • 7. Re: Script problems
                      philmodjunk

                      Your script does not follow the pattern I posted.

                      It must change layouts to a layout based on the portal table and creates the new record there. The script you have posted does not change layouts and uses go to portal row to interact with the portal--not what my script is designed to do. I specifically have it create the new record on a different layout to avoid any need to interact directly with a portal as such script steps are vulnerable to problems created in the future should the design of your layout be changed.

                      I don't see why you need so many set field steps here.

                      Adding a new record in the portal should only require using one set field step to establish the value needed to link the new portal record to the current record on the layout you've posted above here.