Test Data Manager

Expand all | Collapse all

xref() and xlookup() functions

Jump to Best Answer
  • 1.  xref() and xlookup() functions

    Posted 01-05-2017 07:19 AM


    How best we can use xref() and xlookup() functions. Because by referring the online help document doesn't have much reference how to use. it is very grateful if anyone can explain with sample scenario.





  • 2.  Re: xref() and xlookup() functions
    Best Answer

    Posted 01-05-2017 08:05 AM

    Hi Satish, 


    Retrieves the new value that is associated with the given old value from the given cross reference list. Use xref() to set up a cross reference list. Useful for maintaining referential integrity across multiple databases when performing updates.

    Parameters: LIST: a cross reference list, OLDVAL: value
    Return value:  new  value
    Example:  @xlookup(PEOPLE, Joe Bloggs)@


    Adds the pair (old value, new value) to the given cross reference list. Returns the new value. Use xlookup() to retrieve these values later.
    You typically use @xref and @lookup in a datapool that you have constructed to clone data between a source and target. Typically an identifying ID on a column is read from the source, and a new ID is generated to be used on the target. The xref function maps the old (source value) and new ID (generated value) to one another. In a later expression, you use xlookup to retrieve the mapping of the two values.

    Parameters: LIST: a cross reference list, OLDVAL: value, NEWVAL: value
    Return value:  new value
    Example:  @xref(PEOPLE, Joe Bloggs, Vincent Van Gogh)@


    Xrefpersist performs the same basic function as xref, but additionally stores the specified old and new values in the repository. The mappings of OLDVAL to NEWVAL are stored in a list with the name TABLENAME.COLUMNNAME. Xrefpersist stores the old and new values in the gtrep_pj_key_values table when the publish completes. CA TDM portal stores only the table-column combinations that use xrefpersist in the repository. In CA Datamaker, using @xrefpersist once causes all values used in both @xref and @xrefpersist to be stored to the repository. Use the @xlookup method to query the mapping of values later.

    Parameters: TABLENAME: table name where this value has been generated, COLUMNNAME: column name where this value has been generated, OLDVAL: value, NEWVAL: value.
    Return value: new value
    Example: @xrefpersist(PEOPLE, NAME, Joe Bloggs, Vincent Van Gogh)@


    Data Generation Functions and Parameters - CA Test Data Manager - 4.0 - CA Technologies Documentation 


    Does the above not help? If not, can you be specific with what you are confused about or what you are currently trying to do with Datamaker?

    If you do not receive any further examples from other TDM users, please reach out to your CA Account Manager and they will be able to provide a resource to help you with this. If you do not know who your account manager is, please call CA Customer Care at one of these numbers and they will be able to help you- Contact CA Support - CA Technologies 


    Best regards,