[erlang-questions] Issue in searching element in mnesia table

Mikael Pettersson mikpelinux@REDACTED
Fri Apr 6 19:43:47 CEST 2018


You want an index, but not mnesia's but a special-purpose one
maintained by yourself.  In this case, a mapping from these elements
(wxt193 etc) to the test_id:s of the test_info records containing said
elements.  Whenever you add, delete, or update a test_info record
you'll also have to perform the appropriate adjustments to your index
table.

But you should probably take a closer look at your requirements and
try to find another data model that better suits these operations
(finding a record from such an element), if they're frequent.

On Fri, Apr 6, 2018 at 2:47 PM, shiva <gattushivakrishna@REDACTED> wrote:
> Hi all,
>
>     I have requirement of storing list of tuple of elements in record fields
> of a table in mnesia.
>
> This is the record defined for the table,
>
>     record( test_info, { test_id:: integer(), username::atom(),
> test_details::list(), dut_card_details::list(), ats_card_details::list(),
> test_result::list()}).
>
> example:
>
>    This is the 'test_info' table with data,
>
>     {test_info,3,kavi123,
>            ["#102","09:45","11:55",pass],
>            [ommp82_plus,12775,'1_4_3','0.1','0.0.1',123458889],
>            [ats_card,12790,'1_7_5','1.1','0.1.1',123775777],
>            [{port1,{sfp,185,wqc,wxt193,1905,80,no,pass,pass,pass,pass,pass,
>                         pass,pass,pass,pass}},
>             {port2,{sfp,174,was,zte142,1960,80,no,pass,pass,pass,pass,pass,
>                         pass,pass,pass,pass}},
>             {port3,{sfp,189,wsc,svz77,2306,80,no,pass,pass,pass,pass,pass,
>                         pass,pass,pass,pass}},
>             {port4,{xfp,134,was,xtg142,2560,80,no,fail,pass,pass,pass,fail,
>                         pass,pass,pass,pass}}]}
>
> i have an issue, how to search a record, which contains specific element
> from the list of tuple from mnesia table?
>
> example:
>
>     i need list of all the records containing 'wxt193' element in it.
>
> Can you please suggest if any solution to resolve my issue,
>
>
> Regards,
>
> Gattu ShivaKrishna
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list