Help with formula (maybe)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zurdic
    Member
    • Aug 2024
    • 31

    Help with formula (maybe)

    Hi,

    Im created field of type varchar and field of type text, what basically want to do is connect multiple fields into one:

    Click image for larger version

Name:	image.png
Views:	128
Size:	39.0 KB
ID:	109774​(don't cate about booking name for now it's same as booking number)

    But booking_test should be booking number-First name
    Click image for larger version

Name:	image.png
Views:	99
Size:	12.6 KB
ID:	109775
    How do I connect those?
    BookingTest is type of text ​
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1602

    #2
    You need the formula string\conactenate, like so:

    Code:
    cBookingtest = string\concatenate(cBookingNumber, ' ', cFirstNname);
    cBookingNumber and cFirstName must be of type string (VARCHAR or TEXT). I doubt, that cFirstName is. But you might try.

    Comment

    • Zurdic
      Member
      • Aug 2024
      • 31

      #3
      Is there any way how to connet auto increment int + text/varchar cause booking number is auto-increment INT ant first name is text,

      Final should look like this: (datetime in format "YYMMDD") - (int) - (bookingnumber) Firtstname Lastname

      also how to make from date which looks like this 24.5.2024 create this 240524? (I need this for that formula also)

      Comment

      • ChrisSka83
        Senior Member
        • Apr 2023
        • 197

        #4
        Try this formula.
        You just have to adjust the field names.
        dateStart is the field where the date is in, you have to change that.
        int -> auto-increment INT
        and the fields for first name and surname.
        And at the very front the field in which the formula is to be written.
        PHP Code:
        ​
        name=string\concatenate(datetime\format(dateStart, dd.mm.yyyy),' - ', int,' - (',bookingnumber,') ',contact.firstName,' ', contact.lastName); 
        

        Comment


        • ChrisSka83
          ChrisSka83 commented
          Editing a comment
          For the format of the date of course your formatting, I only copied mine.

          dateStart, yymmdd
      • Zurdic
        Member
        • Aug 2024
        • 31

        #5
        Hi,

        Okey it looks better but still doesn't look as we need it, this is how ti looks now:

        Click image for larger version

Name:	image.png
Views:	66
Size:	71.1 KB
ID:	110072​and I need that booking_test look like this 240909-3-00039 FirstName LastName

        Comment

        • Zurdic
          Member
          • Aug 2024
          • 31

          #6
          Click image for larger version

Name:	image.png
Views:	67
Size:	17.2 KB
ID:	110074
          This is current formula

          Comment


          • ChrisSka83
            ChrisSka83 commented
            Editing a comment
            You must note that there are 2 different fields for the date.

            In the standard system, these are dateStart & dateStartDate

            dateStart also contains the time
            dateStartDate only the date

            Have a look at the field overview of your entity to see if you have a field called cArrivalDateStart
        • Zurdic
          Member
          • Aug 2024
          • 31

          #7
          We have also with the time cause we need, when the customer will come at a certain place.

          Is it possible to show it only with date? Or I have to make another field and that field add to that string, if it makes sense.

          And If so, can I add field to be only visible in entity manager/layout manager and not if you are making opportunity (if it makes sense).

          Comment

          • ChrisSka83
            Senior Member
            • Apr 2023
            • 197

            #8
            You already have the fields.
            Let me take the examples from your screenshots
            Hi, Im created field of type varchar and field of type text, what basically want to do is connect multiple fields into one: ​(don't cate about booking name for now it's same as booking number) But booking_test should be booking number-First name How do I connect those? BookingTest is type of text ​


            Arrival Date -> 09 Sep 00:00
            Departure Date -> 12 Sep 00:00

            dateStart -> 240909 00:00
            dateStartDate -> 240909

            now enter Arrival Date -> 09 Sep 10:00
            you get with dateStart -> 240909 10:00
            with dateStartDate -> 240909​

            Comment


            • ChrisSka83
              ChrisSka83 commented
              Editing a comment
              It is also possible that you have named your date fields differently. You will have to adjust it accordingly.
          Working...