[erlang-questions] Comparing tuple records in MatchSpec

Anders Nygren anders.nygren@REDACTED
Fri Apr 26 23:22:34 CEST 2013


Hi,
I don't do this often enough to remember the details so I normally cheat
and use ets:fun2ms.
There are some strange things with tuples having to be in a tuple in the
match spec that always trips me up.

/Anders


On Fri, Apr 26, 2013 at 8:58 PM, Maruthavanan Subbarayan <
maruthavanan_s@REDACTED> wrote:

> Hi,
>
> i have mnesia table which stores date in tuple format {Y,M,D},
>
> To fetch data that falls on given date frames I tried to use this record
>
> MatchSpec = [{#appointment{id='$1', starttime = '$2', endtime = '$3',
>  _='_'},
>
> [{'orelse',{'>=','$2',StartTime},{'orelse',{'=<','$3',EndTime}}}],
>                         ['*']}]
>
> where Startime and Endtime are records. This throws and bad arg during
> transaction.
>
> But when I change the Startime and End time as integer or list it executes
> without any problem.
>
> Is this the normal behaviour, or am I missing out anything, Any work
> around to achieve this?
>
> Thanks,
> Marutha
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130426/95380a92/attachment.htm>


More information about the erlang-questions mailing list