11 Replies Latest reply on Mar 29, 2013 9:12 AM by philmodjunk

    Goto Field containing GetFound Set Text ?

    CStovin

      Title

      Goto Field containing GetFound Set Text ?

      Post

           I have a field which performs a Quick Find.  After it performs it's quick find I would like it to enter ( goto ) the first found field ( in case the found set text has multiple occurances, in multiple records)  which contains that found text.

           All of my fields in my layout have conditional formating so that when a field is active it changes it's Fill color to yellow so that it is more visible.

           The conditional formatting will kick in once the goto field from get found text etc. executes.   It sounds simple but I am not sure how to script this.

           Additionally, would it be possible to create a NEXT / PREVIOUS  found text field found, so that if I am searching it a large text "notes" field it can jump to the next occurance of that found text ?  (Much in the same way a find function works on a web page)

            

        • 1. Re: Goto Field containing GetFound Set Text ?
          CStovin

               Hi Phil,

               So far it's looking good, however I just noticed something else that might require another multi scriping..

               I have a contact -> equipment loan ->line items <- products     soultion.

                

               In my line items portal which is on my equipment loan layout  I have a item_In_Out  field which auto calculates to say "Yes" if the return_date in the portal IsEmpty.   When a date is entered into the return_date field the item_in_out field clears.

                

               This is so I can visually see which individual items are still on load per each Equipment Loan Order.

                

               The problem I am having is portals seem to auto create a new empty portal row for you to begin entering new data.   When this happens the item_In_Out  field auto populates a "Yes"  because the return_date isEmpty  which is fine.... but  I have not entered any product information into the subsequent fields in that portal row.

                

               If Portals will always create a new row at the bottom of your portal waiting for data, how do I write a script that will still allow the "Yes" to appear if the return_date is empty but remain blank   if no product id etc has been entered yet.

                

               My propblem is similar to invoice solutions whose portal has a trash can graphic in the portal row..... The bottom empty row will draw that trash can.

                

          • 2. Re: Goto Field containing GetFound Set Text ?
            philmodjunk

                 First, what's happening under the hood:

                 In the relationship between the layout's Tutorial: What are Table Occurrences? and the portal's, "Allow Creation of Records via This Relationship" has been selected for the Portal's table occurrence. This causes a blank "add row" to appear just below the last actual record shown in your portal. This may look like you have an extra blank record, but no actual data exists here. What you are dealing with is a cosmetic issue, it will not affect the correct function of your layout.

                 If the field showing Yes is a calculation field, you can probably set it up to return "" if it is on this "add row". You can also use conditional formatting to make the contents of the field disappear.

                 You can use a conditional format expression similar to: IsEmpty ( PortaltableOccurrence::SomeFieldThatIsNeverEmpty ) to specify a font size of about 120 points or more to make the contents of that field invisible. This method can also be used to make layout text disappear as well.

            • 3. Re: Goto Field containing GetFound Set Text ?
              CStovin

                   Thanks Phil,  I thought cosmetic surgery might have been the "non-issue." 

                   What I did prior to your response was :   items_out    Calculation    Unstored,=If ( IsEmpty( Lines::return_date ) =1 ; amount )

                   amount is a Line Items table field I created and placed after the Item #ID.  This was I can enter how ever many items are going out in that portal row and that information will remain constant,  but the Items Out value with either disappear or show the amount based on the condition.

                   I thought changing from a "Yes" to an amount was better so that I could create a field_portal_sum  =SUM(Line Items::items_out )   and show how many total items are going out the door per Order

                   Then in COntacts table I created a field which SUMS all the Related Orders portal_sums to give a Full amount of items out

              • 4. Re: Goto Field containing GetFound Set Text ?
                CStovin

                     The interesting thing is when I switched form "YES"  to ;amount

                     No value populates the Items Out field because I have not entered anything in the amount field..... ALthough the the round button on the left still shows in the new empty portal line.... No big deal.

                      

                     Here is something I have been googling for a solution.

                     My portal has scroll bars but after entering 30 items etc. it becomes a bit of work going to the bottom to find the line... I did create a Add Item button which takes me to the last portal row.... but there is still too much mo0use  movement.

                     Is it possible to have two portals which look exactly the same / same fields etc.   The first portal is only 1 line high and is for entering data.  Once everything is entered either a button, or a script trigger trips a script to place all of that information into a second portal below which has scrollbars and more lines 20 plus.... ?

                      

                • 5. Re: Goto Field containing GetFound Set Text ?
                  philmodjunk

                       A simpler way is just to add a button that creates a new related record in the portal's table. You then specify a sort order to lists the most recently created record first in the portal. That way, when you click the button to add a new portal record a new blank row appears at the top of the portal for data entry. This requires a button to add each new record and if you click the button and change your mind you have a new blank record to delete, but these are pretty manageable issues.

                  • 6. Re: Goto Field containing GetFound Set Text ?
                    CStovin

                         cool,  I'm sure that simple solution will get me up and running quickly and effectively.   Not as elegant as 2 portal solution IMHO, albeit advanced programming most likely required.

                         Maybe I'll come back to this possibility down the road as my skills improve.  Thanks a bunch.

                    • 7. Re: Goto Field containing GetFound Set Text ?
                      philmodjunk

                           It might be possible to setup up a one row portal with a filter that excludes related records when there is data in any of the files. The trick would be to make sure the filtered portal updates smoothly to filter out a newly added record at the right time, not too soon, but soon enough that you can then add another new record to the portal without any trouble.

                      • 8. Re: Goto Field containing GetFound Set Text ?
                        CStovin

                             I tired this and it kept adding items to the top row, at the expense of writing over top of the previous row.

                             My relationship Tables Are :  Contacts::_kpcontacts_id  ----> Order::_kf_contacts_id ----> Lines::_kf_orders_id <--- _kp_inventory_id

                             1- Edit Relationship from LINES = INVENTORY  ( nothing checked )

                             2 -Edit Relationship ORDER = LINES  ( Lines - Allow creation of records & Delete related records...)

                             3 - Edit Relationship CONTACTS = ORDER ( Order - Allow creation checked. )

                             My Portal is showing  related records from Lines

                              

                             ( New Line Item Button ) -> script Add Item to Top Row

                              

                             I tried the following script first with the 2nd Relationship (allow creation checked) -  and it went to the top row but deleted all the previous portal rows.  I clicked my script  Add new Line Item button and it deleted again the only row in the portal.

                             I then tried Unchecking the allow creation in the 2nd relationship, and it would not allow me to enter anything in the portal.  No access to any fields.

                                          Goto Object [Object Name:Work Order Portal"]

                                          New Record/Request

                                          Goto Portal Row [Select;Last ]

                                          Goto Field [LINES::_kf_products_id ]

                             Lastly, My Sort Portal is Descending by Lines::timestamp_create

                              

                              

                        • 9. Re: Goto Field containing GetFound Set Text ?
                          philmodjunk

                               To create a new related record in lines from the order layout:

                               Set Variable [$OrderID ; value: _kp_orders_id ]
                               Go to Layout [ Lines ]
                               New Record/Request
                               Set field [Lines::_kf_orders_id ; $OrderID]
                               Go to Layout [original layout]

                               This will work even if "allow creation..." is not enabled for the portal's table occurrence.

                               In the script you posted, New Record/Request is making a new order record instead of a new Lines record.

                          • 10. Re: Goto Field containing GetFound Set Text ?
                            CStovin

                                 Sweeet,,,,, that is pretty slick Phil...  I can Add items as normal & using the Add Item to top row button/script

                                 Cheers

                                  

                            • 11. Re: Goto Field containing GetFound Set Text ?
                              philmodjunk

                                   There is one possible "gotcha" to this script. It can trip a bunch of different script triggers when changing to and from your current layout. The trigger controlled scripts then pop up in the middle of this script, execute and then return control to the original script. That can alter the results produced in undesirable ways, slow down execution of the script or it may be fully harmless.

                                   I sometimes have to "disable" the trigger controlled scripts during this scripts execution. I do that by writing the trigger controlled scripts so that the execute without doing anything if a value is set in a certain global variable. The above script can then set this variable as the start, do its job and then clear the variable before exiting.