CA Service Management

Expand all | Collapse all

ca_fdDoFieldLookup Result

Jump to Best Answer
  • 1.  ca_fdDoFieldLookup Result

    Posted 04-07-2016 04:30 PM

    Hi guys,

     

         I have a lookup field in a SC form in wich i use ca_fdDoFieldLookup('userid', 'catalog__content_contacts_list') wich retrieves the user id and is working fine, now i wanna know if i cant get the First name and last name of that user_id in another text field. Is it possible?.

    I-m trying to do this because i can-t get the Full_name in the result of the ca_fdDoFieldLookup.

     

    Please let me know if i did no explaine myself right, thanks in advance.

     

    Regards.

     

    PD> the ca_fdDoFieldLookup('userid', 'catalog__content_contacts_list') brings information from ca_contacts in CA SDM.



  • 2.  Re: ca_fdDoFieldLookup Result

    Posted 04-08-2016 10:12 AM

    Hi Hernan.

    The following is an example to get this working.

    In sc/admin/report builder, create a data object.
    type     = query
    id       = catalog_contact_list
    database = mdb
    table    = ca_contact
    fields   = userid,first_name,last_name
    query    = SELECT userid,first_name,last_name
               FROM ca_contact
               WHERE upper(userid) like  upper('%STRING%%%')
     
    In SC/Catalog/Forms, create a form with:
    A: The Lookup component on the form:
    _id = userid
    onLookup= ca_fdDoFieldLookup('userid','catalog_contact_list')

    NOTE: userid is the first field of the data object fields.
          id-value is the id of the data object

    B: The 'text field' component on the form is the field to be filled with data from lookup:
    _id = first_name
    _id = last_name
    The value for '_id' must be equal to the field in the data object.
    And will then be automatically populated when the query executes.
    E.G. for another text field on the form, to be populated with the contact's first_name (as in the query-text),
    the _id of that field must/should be first_name too.

    Does this answer your question? And help you further on this?

    PS.
    When you change the query into:
    query =
    SELECT userid,first_name as firstname,last_name as lastname
    FROM ca_contact
    WHERE upper(userid) like  upper('%STRING%%%')

    Then the _id of th fields on the form should be firstname and lastname.
    Equal to the ones that youuse in the 'as' clause in the query-text.

    Thanks and kind regards, Louis.



  • 3.  Re: ca_fdDoFieldLookup Result

    Posted 04-11-2016 12:20 PM

    Louis,

              i was able to populate a new text field with the Last name and the First name so it is working good, now how can i make them show up in the same text field: Last_name + First_name?



  • 4.  Re: ca_fdDoFieldLookup Result

    Posted 04-11-2016 12:43 PM

    You can do something like the following:

     

    select last_name+', '+first_name as cn from ca_contact where userid='%userid%'

     

    Just ensure the _id of the text field you want to populate is defined with the alias (i.e. 'cn' above).



  • 5.  Re: ca_fdDoFieldLookup Result

    Posted 04-12-2016 02:01 PM

    Can i do the " last_name+', '+first_name " at form level? i can't get it working as data object query...



  • 6.  Re: ca_fdDoFieldLookup Result
    Best Answer

    Posted 04-13-2016 06:30 PM

    You can definitely do that via JavaScript however I verified the above query works both from the data object as well as in the form. Following is the data object I tested with:

     

    Database: mdb

    Table: ca_contact

    Fields: cn

    Query: select last_name+', '+first_name as cn from ca_contact where userid='%userid%'



  • 7.  Re: ca_fdDoFieldLookup Result

    Posted 04-15-2016 03:47 PM

    Thanks a lot!! that worked for me!!

     

    Regards.



  • 8.  Re: ca_fdDoFieldLookup Result

    Posted 04-20-2016 06:35 PM

    P@

     

    Y4eezdAwq pd D

     

    J.P. Morgan Asset Management

    AM Tech PMO

    George.Robertson@jpmorgan.com

    www.jpmorgan.com/assetmanagement

    4041 Ogletown Road, Floor 2

    Newark, DE 19713-3159

    Phone: 302-455-3546

    Mobile: 347-524-7709