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

Not all columns are shown for filtering a table #386

Closed
pgrill79 opened this issue Jun 22, 2024 · 4 comments
Closed

Not all columns are shown for filtering a table #386

pgrill79 opened this issue Jun 22, 2024 · 4 comments
Assignees
Labels
bug Something isn't working question Further information is requested
Milestone

Comments

@pgrill79
Copy link

I have a table, but for filtering i cannot choose some columns (Marked red) - maybe because of special characters ?

image

@aeberhart aeberhart self-assigned this Jun 22, 2024
@aeberhart aeberhart added the bug Something isn't working label Jun 22, 2024
@aeberhart aeberhart added this to the 5.2 milestone Jun 22, 2024
@aeberhart aeberhart added the question Further information is requested label Jul 2, 2024
@aeberhart
Copy link
Contributor

@pgrill79 I suspect it has to do with the column datatype. Can you check the types of these in the DB.
You can also run this query in the Notebook:

$all("config", "Property")[type!="string" and type!="object" and type!="array" and type!="boolean" and type!="number"]

@pgrill79
Copy link
Author

Hi @aeberhart - i have executed the command in the notebook and this is the result:

[
  {
    "ID": "dj/config/Property/pkpos",
    "name": "pkpos",
    "parent": "dj/config/Property",
    "type": "integer",
    "widget": "select",
    "choices": [
      null,
      0
    ],
    "displayWithChoices": [
      "---",
      "Primary Key"
    ],
    "title": "Key"
  },
  {
    "ID": "dj/config/dj-config/integer",
    "name": "integer",
    "parent": "dj/config/dj-config",
    "type": "integer",
    "case": [
      "integer"
    ]
  }
]

The query which is executed is the following:

SELECT DISTINCT
    b.name as "Rasse",
    b.rc as "RC",
	coalesce(a.origin,'') || coalesce (a.eartag,'') as "TVD-Nr. / HB Inschrift",
        --a.id as "TVD-Nr. / HB Inschrift",
	a.name as "Name",
	s.name as "Sex",
	a.birth as "Geburtsdatum",
    lmid.last_mating_or_insemination_date as "letztes Beleg-/Wurf-/Besamungsdatum",
	v.rc as "RC V",
	coalesce(v.origin,'') || coalesce (v.eartag,'') as "TVD-Nr. V",
	vv.rc as "RC VV",
	coalesce(vv.origin,'') || coalesce (vv.eartag,'') as "TVD-Nr. VV",
	vm.rc as "RC VM",
	coalesce(vm.origin,'') || coalesce (vm.eartag,'') as "TVD-Nr. VM",
	m.rc as "RC M",
	coalesce(m.origin,'') || coalesce (m.eartag,'') as "TVD-Nr. M",
	mv.rc as "RC MV",
	coalesce(mv.origin,'') || coalesce (mv.eartag,'') as "TVD-Nr. MV",
	mm.rc as "RC MM",
	coalesce(mm.origin,'') || coalesce (mm.eartag,'') as "TVD-Nr. MM",
	trim(coalesce(c.name,'') || ' ' || coalesce(c.lastname,'') || ' ' || coalesce(c.firstname,'')) as "Betrieb (Name, Vorname)",
	c.adressline1 as "Strasse",
	c.zip as "PLZ",
	c.city as "Ort",
	c.reference as "BTR-Nr"
	
FROM animal a
LEFT JOIN breed b ON A.fk_breed = b.id
LEFT JOIN sex s ON A.fk_sex = s.id
LEFT JOIN relationsflat v on v.sourceanimalid=a.id and v.relativerelation='f'
LEFT JOIN relationsflat vv on vv.sourceanimalid=a.id and vv.relativerelation='ff'
LEFT JOIN relationsflat vm on vm.sourceanimalid=a.id and vm.relativerelation='fm'
LEFT JOIN relationsflat m on m.sourceanimalid=a.id and m.relativerelation='m'
LEFT JOIN relationsflat mv on mv.sourceanimalid=a.id and mv.relativerelation='fm'
LEFT JOIN relationsflat mm on mm.sourceanimalid=a.id and mm.relativerelation='mm'
LEFT JOIN contacttoanimal c2a ON c2a.contactto = a.id and c2a.active and c2a.relationtype=2
LEFT JOIN client c ON c.id = c2a.contactfrom
LEFT JOIN last_mating_or_insemination_date lmid on lmid.animalid=a.id
WHERE COALESCE(a.deceased,false)=false
AND (c2a.contactfrom=${clientId} or ${clientId}='0')

So the missing fields are all concatenated string values

@aeberhart
Copy link
Contributor

the call to query Metadata only set the dbType and not the type attribute.
This attribute determines whether and what kind of filter is shown.

@aeberhart
Copy link
Contributor

Note that we have to disable filters for column names containing "." see #392

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants