Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query returns multiple times the same result #40

Open
Emener opened this issue Apr 27, 2015 · 0 comments
Open

Query returns multiple times the same result #40

Emener opened this issue Apr 27, 2015 · 0 comments

Comments

@Emener
Copy link

Emener commented Apr 27, 2015

As a preface, I'll apologize : I'm french, so there are French words in my queries and my tables.

Anyways, I've been having problem with the queries frome Parse4J.

In my data on Parse.com, I have Themes and SubThemes in the same table, but Themes have as RootTheme "Root", while SubThemes have as RootTheme another Theme.

I've been trying to add the results of a query into a ComboBox, but the Query has been returning me 5 times the same result, instead of the 5 RootThemes.

Here's my code :

private ParseQuery<ParseObject> themeQuery;
private ObservableList<String> themeComboData;

@Override
public void initialize(URL location, ResourceBundle resources) {
    themeComboData = FXCollections.observableArrayList();
    themeQuery = ParseQuery.getQuery("Theme").whereEqualTo("RootThemeID", "DBWw03ygSv");
    themeQuery.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> themeList, ParseException e) {
        if (e == null) {
            for(int i = 0; i < themeList.size(); i++){
                    ParseObject themeTemp;
                    themeTemp = new ParseObject("Theme");
                    themeTemp = themeList.get(i);
                    themeComboData.add(themeTemp.getString("Name"));
            }
        } else {
            Logger.getLogger(AmIApp.class.getName()).log(Level.SEVERE, null, e);
        }
        }
    });
    themeCombo.setItems(themeComboData);
}

But all it does is filling my Combo Box themeCombo with 5 times "Affinités", instead of the 5 different RootThemes.

Any advice ? Thanks in advance :)

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

No branches or pull requests

1 participant