Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
Hello All!
Greetings KK Sir!

I have an editable region defined as:
Code: Select all
<cms:editable name="status" label="Status" type="dropdown" opt_values="Select =- | assigned | in-progress | complete | on-hold | production" opt_selected="-" searchable="0" required="1" order="5" />


The status that I want to set are being set perfectly in any manner the operation is being performed.

The scenario is that:
1. There is a list of apartments with some details and its status
2. I want to display the count according to the status

I have tried the following two approaches.
Approach #1 (Works fine and displays the count)
Code: Select all
<cms:set complete_count="0" "global" />
    <cms:pages masterpage="data.php" show_future_entries='1' >
        <cms:if status=="complete">
       <cms:incr complete_count '1' />
       <cms:set complete_count="<cms:show complete_count />" "global" />
        </cms:if>
    </cms:pages>
<cms:show complete_count />


Code: Select all
Approach #2 (No result, count is always '0')

Code: Select all
<cms:pages masterpage="data.php" show_future_entries="1" custom_field="status='complete'" count_only="1" />


What is the issue in the code of the second approach? Could I be helped to correct it!

Thanks in advance!

Regards,
GenXCoders
Image
where innovation meets technology
Hi,

I think the single-quotes around 'complete' are the problem.
Please try using the following -
Code: Select all
custom_field="status=complete"

or this for exact match -
Code: Select all
custom_field="status==complete"

Hope this helps.
@KK Sir,

Sir I have already tried the options you have mentioned. And it does not work.

I have also tried:
custom_field="status=complete"
custom_field="status==complete"

custom_field="status=<cms:show 'complete' />"
custom_field="status='<cms:show "complete" />'"

custom_field="status==<cms:show 'complete' />"
custom_field="status=='<cms:show "complete" />'"


But nothing works :(
Image
where innovation meets technology
That is because you have configured the field to be unsearchable -
<cms:editable name="status" label="Status" type="dropdown" opt_values="Select =- | assigned | in-progress | complete | on-hold | production" opt_selected="-" searchable="0" required="1" order="5" />

You'll need to set searchable="1", visit the template as super-admin for the change to persist and then *also* save all pages individually for the search field to get populated in the database.

Hope this helps.
@KK Sir,
I have set searchable to '1' and deleted and repopulated the data and it is now working.
But the values of dropdown editable works for the following options:
1. complete
2. assigned
3. in-progress
4. production
only.

It does not work for on-hold.
I tried clearing the cache and using <cms:nocache /> tag too, still it does not work for on-hold.

For on-hold i have to use the <cms:incr...> thing. I will try to figure the issue. For now the solution provided by you is working.

Sir could you please explain me the searchable attribute in your way. I will be really greatful.

Regards,
GenXCoders
Image
where innovation meets technology
I think what is happening is this -
just saving a page (as I mentioned in my last post) will *not* update the database because the dropdown selection remains unchanged and this makes Couch skip that field.

You'll actually need to change the selection to something else, save, then select the desired value and save again. This will save the correct value in the search field and your <cms:pages> code will work.

I am sorry this pretty messy but cannot be avoided.

Hope this helps.
@KK Sir

You'll actually need to change the selection to something else, save, then select the desired value and save again. This will save the correct value in the search field and your <cms:pages> code will work.


Ok Sir I will give it a try and get back on the same.

Regards,
GenXCoders
Image
where innovation meets technology
7 posts Page 1 of 1
cron