NICE. Thanks!
Now, while I have you on the line, the following:
# Create dataset of All Records, then sort it
dsAllRecords = DBlookup[:main]
dsAllRecords = dsAllRecords.order(:BeginCallNumber)
# Create dataset of Eisenhower General Collection that are NOT Quarto or
Folio
dsEisenhowerGeneralCollection = dsAllRecords.where('BeginCallNumber NOT
LIKE "%QUARTO" AND BeginCallNumber NOT LIKE "%FOLIO" AND CollectionCode =
"Eisenhower General Collection"').sql
I was assuming that "dsEisenhowerGeneralCollection" here is a new dataset.
And yet, further down in my code when I try to issue a
dsEisenhowerGeneralCollection.each I get a "method undefined" error again.
dsEisenhowerGeneralCollection.each do |row|
puts row[1]
end
Thinking....
Mark
On Sunday, April 23, 2017 at 3:04:37 PM UTC-4, 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
>
> # 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 (!).
>
> I'm kind of at a loss here. Advice appreciated by this Ruby Newbie!
>
> Mark
>
--
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.