Dynamic fields in mnemosyne query

HENNIEM MULLER <>
Wed Jul 28 13:38:16 CEST 2004


Hi,

I need to write a function that will retrieve a record from a mnesia db. The function receives 2 args. First the value for a key field, then the actual field name of the key. I wrote the function as follow:

select(Key, SearchBy) ->

	    Handle = query
			 [ P || P <- table(pos_table), P.list_to_atom(SearchBy) = Key]
		     end,

      L = mnesia:transaction(
           fun() ->
               mnemosyne:eval(Handle)
           end).

However, when it compiles, it gives me the error:
undefined database record field "list_to_atom".
If I remove the list_to_atom, it gives me a syntax error.

Can anyone please?

Hennie Muller
  "Anything is possible,"
  "except this..."
#####################################################################################
The information contained in this message and or attachments is intended
only for the person or entity to which it is addressed and may contain
confidential and/or privileged material.  Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon,
this information by persons or entities other than the intended recipient
is prohibited. If you received this in error, please contact the sender and
delete the material from any system and destroy all copies.
#####################################################################################



More information about the erlang-questions mailing list