On Sunday, April 23, 2017 at 12:04:37 PM UTC-7, Mark Cyzyk wrote:
>
>
> Greetings.  Ruby Newbie here.
>
> I am just trying to do something simple and have hit a wall.  I am trying 
> to create a dataset with a WHERE clause.  (An in-memory SQLITE3 DB is the 
> backend.)  Here are my attempts:
>
> # Create dataset of All Records, then sort it 
> dsAllRecords = DBlookup[:main] 
>
dsAllRecords = dsAllRecords.order(:BeginCallNumber).all 
>

This returns an array, not a dataset, so you can't call dataset methods on 
it.  Drop the .all if you want a dataset and not an array. 

>  
> # Create dataset of Quartos, then sort it 
> # dsQuarto = DBlookup[:main].filter(:BeginCallNumber.like('%QUARTO')) 
> # dsQuarto = dsAllRecords.where(Sequel.like(:BeginCallNumber, '%QUARTO'))  
> # dsQuarto = dsAllRecords.where('BeginCallNumber LIKE "%QUARTO"').sql 
> # dsQuarto = dsAllRecords.grep(:BeginCallNumber, '%QUARTO') 
> dsQuarto = dsQuarto.order(:BeginCallNumber).all
>
> These four statements each fail when I run them individually:
>
> dsQuarto = DBlookup[:main].filter(:BeginCallNumber.like('%QUARTO')) 
> dsQuarto = dsAllRecords.where(Sequel.like(:BeginCallNumber, '%QUARTO'))  
> dsQuarto = dsAllRecords.where('BeginCallNumber LIKE "%QUARTO"').sql 
> dsQuarto = dsAllRecords.grep(:BeginCallNumber, '%QUARTO')
>
> I gleaned these techniques for issuing a WHERE statement from the Sequel 
> docs and other tutorials.  The middle two result in a Method Undefined 
> error on "where()".  The last one results in an error saying I provided to 
> grep two arguments when it was expecting only one (!).
>

These errors are because you are trying to call dataset methods on an array.

Thanks,
Jeremy 

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to