Layer7 API Management

  • 1.  mapping values from one column to another column

    Posted Feb 20, 2018 05:57 AM

    Hi All,

     

    how can we map values from one column of database to another column of another database using LAC.

     

    Database1

    username  id      uid       phase  profession

    tony           23   00023    eight    Architect

    Jack          68   00094     fifth     Counsellar

    .

    .

    .

    .

    n

    Database2

    username  id      uid       phase  profession

     

    ...........     . . ..     .. ...     ........     ...........

    ..........      ......    .. ....    .........    ............

     

    Need to map the values from database 1 to database 2 correspondingly using lac column wise.

     

     

    Thanks,



  • 2.  Re: mapping values from one column to another column

    Posted Mar 01, 2018 02:09 AM

    Hi, team, can someone help on this !!!



  • 3.  Re: mapping values from one column to another column

    Broadcom Employee
    Posted Dec 19, 2018 06:49 PM

    Hi Irfan, it looks like your question fell through the cracks, and we're only now getting to respond to it -- my apologies for that.

     

    It depends what you mean by "mapping values" between databases. Do you mean that you have two tables with essentially the same columns, but in two separate databases, and you want to retrieve data from both? Or do you mean that you need to retrieve data from both tables with a join?

     

    If it's the latter, then you can define a virtual relationship between these two tables, and then create a resource that spans both tables. This is assuming that there is more or less a one-to-one correspondence of (presumably) the primary key, so that you can do a meaningful join (maybe using uid, for instance). That would give you two levels of data, one level for each table.

     

    If you are trying to retrieve data from both tables in one result (say, you have users A-M in database 1 and users N-Z in database 2, and you want these two tables to be treated as one), that can be more challenging. Are these two databases in the same server, or at least same instance? In other words, is the database capable of running a query that spans both tables? If so, you could use a free SQL resource to do a union of both tables.

     

    If that's not the case, say one table is in Oracle and the other is in SQL Server, then it's going to more difficult to query the two tables in unison. Not impossible -- but more difficult. If that's the case, please let us know the details and we'll see if we can be of assistance.



  • 4.  Re: mapping values from one column to another column

    Posted Dec 20, 2018 05:10 AM

    Hi,

     

    Thank you for the reply.

     

    We have two tables with the same column name on a database (Oracle).

    We need to update the second table if the first table is updated. The Primary key will be the ID Column.

    So how can we move ahead with the Development.

     

     

    Thanks,

    Irfan



  • 5.  Re: mapping values from one column to another column

    Broadcom Employee
    Posted Dec 20, 2018 12:31 PM

    A common way of doing this is to use an event rule defined on table A. That event would update table B whenever an insert/update/delete happens on table A. You would probably use something like an event on TableA:

     

    if (logicContext.getVerb() == "INSERT") {

      SysLogic.insertChildFrom("TableB", logicContext);

    }

    else if (logicContext.getVerb() == "UPDATE") {

        etc...

     

    The examples have a fair number of similar things. Is this what you had in mind?

     



  • 6.  Re: mapping values from one column to another column

    Posted Dec 21, 2018 01:07 AM

    Hi,

     

    Yes i am looking for something similar suggested by you.

    Thank you for the help. 

     

    Thanks,

    Irfan