hi
is there a reason you put the name of read_action after ":" ??
/^36[0-6]$/:read_datos_todos{fn:read_datos_todos}
try
/^36[0-6]$/:{fn:read_datos_todos}
/^36[7-9]$/:{fn:read_datos}
/^37[0-9]$/:{fn:read_datos}
Hi, I put it there in order to be used by the view as the data provider.
If I put {fn:read_datos} in the view it works ok but i need the data provider to be changed matching the user code in the regex.
Pelease, Can someone help me ?
Thanks!
In the switch just have the {fn:read_...} part
Then in your data provider do {var:read_dataoption1}|{var:read_dataoption2}|{var:read_dataoption3}
Give them the correct names of course
Doing that, it should use whichever read data actually has data.
Thanks gix.vax and healyhatman for your answer.
I put in the switch_read only the read functions:
/^36[0-6]$/:{fn:read_data1}
/^36[7-9]$/:{fn:read_data2}
/^37[0-9]$/:{fn:read_data3}
It works ok at this part but I want to have only 1 view, how do I know wich data reader was chosen?
I tried to implement a switch to the views: switch_view
/^36[0-6]$/:{view:datos_list1}
/^36[7-9]$/:{view:datos_list2}
/^37[0-9]$/:{view:datos_list3}
The view datos_list1 has {var:read_data1} as the data provider
The view datos_list2 has {var:read_data2} as the data provider
The view datos_list3 has {var:read_data3} as the data provider
The event:
{fn:switch_read}
{fn:switch_view}
But I can't make it work!
Do you know another way to do that?
You can put both things in the one switch
You have "return the result as var" turned on, which as the description says won't print. Turn it off.
Hi, thank you, turning off "return the result as var" works fine so at this point I can switch between data readers and viewers using a single switch.
But I still need some help because there are links in the view list table referencing to the row item that doesn't work:
Table column view:
Dato.Nombre:{view:dato_view_link}
and
dato_view_link Content:
{var:datos_list_table.row.Dato.Nombre}
dato_view_link Parameter:
dato_aid={var:datos_list_table.row.Dato.aid}
I don't want to have every link duplicated so I put a session var with the chosen view
I have the variable {session:alegria.dataviewer}
The question is how can I dynamically reference to the view item like this?:
dato_aid={var:{session:alegria.dataviewer}.row.Dato.aid}
But the above code doesn't work.
data_aid={session:alegria.dataviewer.row.Dato.aid}
Sorry healyhatman but it doesn't work.
Use a {debug:} to see what data you have available
Why are you using {session:user.id} by the way, instead of just using {user:id} ?
And try just putting both data sources in the link. Like href="{var:source1whatever}{var:source2whatever}" since only one of them will actually have anything in it.
Could also move these things to their own event. So in your switch you could have {event:somethingsomething} and then you can put all your views and read datas in the event.