Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

What kind of operator to use? #1495

Open
Jscott388 opened this issue Jul 3, 2017 · 4 comments
Open

What kind of operator to use? #1495

Jscott388 opened this issue Jul 3, 2017 · 4 comments

Comments

@Jscott388
Copy link

var list = new Promise(function (resolve, reject) {
  rets.getAutoLogoutClient(config.clientSettings, (client) => {
    var results = client.search.query(SearchType, Class, Query, {
      limit: 1,
      offset: 1
    });
    resolve(results);
  });
});

var source = Rx.Observable.fromPromise(list);

source.subscribe(results => console.log(results.count));

This is real estate data. I am limited to certain amount of data I can return in one query. I need to cap my limit, say 500. If there are 1600 records, this would need to run 4 times. What operator would I use for this? So my first run would be limit 500, offset, 1... Then I each run I would need to do offset += limit until I my offset is > than the count.

Would I want to use the Observable.while? Not sure on how to work with this.

My results.count comes from this. Not showing all the data, but results.results[0] would give me over 520 fields of data that I have to parse through.

maxRowsExceeded: true,
replyCode: '0',
replyTag: 'OPERATION_SUCCESSFUL',
replyText: 'SUCCESS',
count: 1694,
rowsReceived: 1,

@paulpdaniels
Copy link
Contributor

This is more of a StackOverflow question, you'll get much more visibility there. But since you are here, I would suggest that you look at the expand operator, with the idea of recursively calling your API, until the total items returned equals the total count.

@Jscott388
Copy link
Author

@paulpdaniels Yeah I thought so, but I can't get my head around this as there isn't many examples of this any where that I can understand.

My problem is I have to run the call to even find the count. So I don't know where to start or where my .expand will be placed into.

@paulpdaniels
Copy link
Contributor

Just saw your post, I'll see if I can put together an answer. And again apologies for not elaborating more on here, but SO has a lot more visibility, and it is likely if you are having an issue then so are others, and I would hate for any answer to get buried in an old issue thread.

@larssn
Copy link

larssn commented Jul 4, 2017

Yeah IMO post on SO, as the answer might bring value to others. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants