1 2 Previous Next 27 Replies Latest reply on Mar 30, 2017 7:00 PM by user17152

    Set color per user


      The problem I have a notes field in a dashboard to keep notes per day. The database is used by 3 users. So the same record and the same field (notes) is used by the same users. What i am trying to accomplish is seting a different color per user so when each user logs in he will have the same pen color lets say red. By that way when he writes something in the notes field will be red color when another user writes hiw word will be green etc.

      Maybe is very simple maybe its hard but I cant find a way to do that. Any ideas?

        • 1. Re: Set color per user

          Rather than make multiple entries in the same field, set up a related table of notes with a separate entry in each record. This will make identifying the author of each note much easier, their name can be displayed as part of each new "note" record. A portal to such a table can replace your current single text field.

          • 2. Re: Set color per user

            In the right place I have reminders that works as you say! You can see in the records its says "admin, mania" etc.

            I want to do what it is in the notes I dont want to have notes per user I wont like the interface




            Screen Shot 2017-03-30 at 18.22.32.jpg

            • 3. Re: Set color per user

              That doesn't make sense to me. Putting a portal in place of that field could produce an interface nearly identical to what you have there.


              There are ways to do what you want by using a script as part of the data entry process, but seems like you are unnecessarily complicating your design in support of a less than optimum way of recording and tracking the notes data.


              You could add a popover button with a global text field inside. When the user enters a new "note" and clicks "save"--a button you'd add to the popover panel, a script checks a table where you have one record for each user with RGB values for a color for each user to get the RGB values to use with the TextColor function to append colored text from the global text field to the end of the existing text in your notes field.

              1 of 1 people found this helpful
              • 4. Re: Set color per user

                It is already a single line portal with a relationship to the date I pick from the dashboard. I can do what you describe but then again I would have to do that to many layouts and fields wherever I have notes. I am booking a reservation of course  I keep track the user that created or modified the record. But also there I have a notes field for the particular reservation where any user can add things the same I have notes lets for a bath, a transfer and for every service.Your way works and of course I can implement it.

                I am not looking for a way to do what you are suggesting I have my reasons not to do it this way.


                So the question remains Can I script Get(acountname)="mike" set pen color red or something like this so I wont have to do something for every note field in every table and layout. This would work "globally"

                • 5. Re: Set color per user

                  Not a single row portal, but a multi row portal. If this is a single row portal, you may not need the portal at all unless you are using portal filtering as well as a relationship to show the correct record.


                  And if changing this on multiple layouts is your only reason for not doing it, that's not much of a reason. It can take work to correct design deficiencies when you learn a better way. The work to do that would be less than the work to automatically color the input.


                  As to your other question, I answered it in my last post. You can set up a table of user accounts and colors. Your script would use the current user's account name to look up and apply the needed color.

                  • 6. Re: Set color per user

                    I understand your suggestions and thank you for your time to answer me. As I understand there isnt a way to always have a user to use the same color in whatever he is doing in a startup script "if user is mike then use red color everywhere" your suggestion is to have a global field that someone can write and by "transferring" this to the notes field changing the color

                    • 7. Re: Set color per user

                      It's not a matter of setting the color to the user. That part is easy. Given that you are entering multiple entries into one field, it's a matter of identifying which text in that field needs to be formatted with that color. Having the user enter that data first and then using a script to format it with a color is the simplest method that I can think of. Having them enter the data in a different field first, makes it easy to determine which text to select for that applied color.


                      An OnObjectSave trigger could conceivably start at the end of the text field and "scan left" in a loop until it reaches text that is not black, then select and apply a color. This would not be a simple script and requires using a function that can access the color formatting such as GetAsCSS. If you look up this function in Help you'll see why getting to the color info to do this isn't a simple script as color formatting tags enclose blocks of text in your text field and you have to find the tag, interpret it and then correctly determine what text to select before applying a user specific color to it.


                      And at that, this assumes that the users will always enter new text in the same relative location, always at the end or always at the beginning. Any exceptions to that and the script fails anyway.


                      Another approach would be to use OnObjectKeystroke to apply that user specified color one letter at a time....

                      1 of 1 people found this helpful
                      • 8. Re: Set color per user

                        "It's not a matter of setting the color to the user. That part is easy. Given that you are entering multiple entries into one field, it's a matter of identifying which text in that field needs to be formatted with that color."

                        This is that i dont get where is the easy part if I can do that when somenone opens the file then the text will be formated in the time of the entry. So if I can set a color per user there will be no need to identify the text that needs to be changed.

                        Another approach that I am thinking is setting an auto calculation for the field to change the record with a case statement if text is red or green or yellow dont change it and then if user is "mania" change the (black) to to the correct color

                        • 9. Re: Set color per user

                          you can do it by separating the entry from what is viewed.



                          the user enters his text in a field and on exiting that text is colored according to his or her user name and is inserted into the notes field under the previous insertion.


                          That will work.


                          You will need to figure out how to put the field in there. You can do it putting one field on top of another.so it takes no more real estate. The top field shows the colored text by user and is a calculation field and not accessible in browse mode.

                          the field under is the field where the user enters his or her reply. At first the user sees the colored text. When he clicks to enter his response he gets the field under it (a text field) he types his text and when he leaves the field the script trigger cuts and adds the text including the colour to a hidden field. that hidden text field is the field that the calculation field uses to show the colored text.

                          1 of 1 people found this helpful
                          • 10. Re: Set color per user

                            Ok so with a plus button and a popover global field i can put colored per user notes into the notes field.

                            The problem now is that i want every user to be able to delete  inside the notes field ( I dont care if it is his note or whatever note) but I dont want him to be able to write there because it wouldnt use the specified color.

                            The notes are for "silly" things I dont care if they delete them or whatever dont tell me about security audit logs etc.

                            Lets say its just a blackboard and everyone has its own pencil and one sponge.

                            Is there a way to have a field that you can delete inside but not write?

                            • 11. Re: Set color per user

                              And so the complications increase.


                              You could put a calculation field on the layout that copies the value of your notes field and that takes its place on the layout. A delete button's script can use get (selectionStart) and get(selectionSize) to determine what text to delete.

                              1 of 1 people found this helpful
                              • 12. Re: Set color per user

                                to allow any user to delete or modify any other user's comment, your popover field would show all the text , so the user could make changes delete whatever. When he or she leaves the field whatever is left is put in the hidden field which calculates to the calculation text field in the portal.

                                If you want to retain the colour of what was left over from what the other user said then you would show each user's comment in a separate field. you could do that by using a repeating field. Each repetition would be a note from a user. So when a user changed one note but not the reply then it could update properly maintaining the colours of each user's text. You could use a portal too.

                                So when the user clicks on the field he sees a repeating field with each user's comment. whatever he changes or adds or deletes then can easily be calculated back into the calculation field that shows to all users.



                                1 of 1 people found this helpful
                                • 13. Re: Set color per user

                                  "And so the complications increase."

                                  All I wanted is a script step Set (and lock) Color by user


                                  Anyway thank you both!

                                  • 14. Re: Set color per user

                                    "And so the complications increase."


                                    Be nice a little. We are trying to help. If a proposed solution to your problem does not meet your requirements then let it go. After all 'complicated' is in the eye of the beholder. I dont see complicated. But I respect your response, the way you see it. I did spend the time though to send you that response. to think it through and send a draft.


                                    We are not thousands in numbers to respond. So be nice please.



                                    1 2 Previous Next