ndegoeij
I'm new here

Filter query for released items

Jump to solution

In FirstSpirit 4.2.489 I have created a table with some fields. Upon this table we created a datasource with input components and a mapping to the table fields.

After this I would like to use the data of this table as an select list component (CMS_INPUT_COMBOBOX) in another data source with one restriction; this select list should have a query (with filter) on it which shows only the released items of the first table.

How can I create a filter query which shows only released items as a result set?

0 Kudos
1 Solution

Accepted Solutions
pavone
I'm new here

Hello,

you could try this:

Open your query and select the tab "Conditions". At the top, uncheck "Wizard mode" so you see the actual query code. Then wrap your conditions with an AND-tag and add the following line:

<NOTNULL attribute="released by"/>

So your query looks like something like this

<QUERY entityType="products">

  <FILTERPARAM parameter="category_id" datatype="java.lang.Integer" value="123"/>

  <AND>

    <EQ attribute="product_categories.fs_id" parameter="category_id"/>

    <NOTNULL attribute="RELEASED_BY"/>

  </AND>

</QUERY>

This will exclude all items which have not been released. But it will also exclude items that had been released and then were changed without being released again! You will NOT get the released version of the item.

Best regards

Tim

View solution in original post

0 Kudos
2 Replies
pavone
I'm new here

Hello,

you could try this:

Open your query and select the tab "Conditions". At the top, uncheck "Wizard mode" so you see the actual query code. Then wrap your conditions with an AND-tag and add the following line:

<NOTNULL attribute="released by"/>

So your query looks like something like this

<QUERY entityType="products">

  <FILTERPARAM parameter="category_id" datatype="java.lang.Integer" value="123"/>

  <AND>

    <EQ attribute="product_categories.fs_id" parameter="category_id"/>

    <NOTNULL attribute="RELEASED_BY"/>

  </AND>

</QUERY>

This will exclude all items which have not been released. But it will also exclude items that had been released and then were changed without being released again! You will NOT get the released version of the item.

Best regards

Tim

0 Kudos
Anonymous
Not applicable

Hello Nando,

I'd recommend the following:

<QUERY entityType="products"> 
  <AND>
    <EQ attribute="FS_RELEASE_TO" datatype="java.lang.Long" value="9223372036854775807"/>

    <EQ attribute="FS_VALID_TO" datatype="java.lang.Long" value="9223372036854775807"/>
  </AND>
</QUERY>

this should only select the currently valid and released items from the datasource.

Best,

Nils