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

relation between two tables manyToOne #366

Closed
aymen6 opened this issue Mar 12, 2018 · 8 comments
Closed

relation between two tables manyToOne #366

aymen6 opened this issue Mar 12, 2018 · 8 comments

Comments

@aymen6
Copy link

aymen6 commented Mar 12, 2018

i need to show the person name
actually i show the id of person

public void onViewBind(View view, Cursor cursor, ODataRow row) {
OControls.setText(view, R.id.name, row.getString("person_id"));
}
there are a relation manyToOne between class (sanction) and (ResPartner)

in this class(sanction)
i put this code
OColumn person_id = new OColumn("name", ResPartner.class, OColumn.RelationType.ManyToOne);
he shows me the id of person but i need to show his name
what can i do ?

"person_id": [
81,
" JackZ"
],

@fedache
Copy link

fedache commented Mar 14, 2018

ODataRow resPartner = row.getM2ORecord("person_id").browse()

@aymen6
Copy link
Author

aymen6 commented Mar 15, 2018 via email

@fedache
Copy link

fedache commented Mar 15, 2018

public void onViewBind(View view, Cursor cursor, ODataRow row) {
ODataRow resPartnerRow = row.getM2ORecord("person_id").browse();
OControls.setText(view, R.id.name, resPartnerRow.getString("name"));
}

@aymen6
Copy link
Author

aymen6 commented Mar 15, 2018 via email

@aymen6
Copy link
Author

aymen6 commented Mar 15, 2018 via email

@fedache
Copy link

fedache commented Mar 15, 2018

person_id can't be a json array, its an integer -->
OColumn person_id = new OColumn("name", ResPartner.class, OColumn.RelationType.ManyToOne);

Its not required

@aymen6
Copy link
Author

aymen6 commented Mar 15, 2018 via email

@aymen6
Copy link
Author

aymen6 commented Mar 15, 2018 via email

@aymen6 aymen6 closed this as completed Mar 27, 2018
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

2 participants