Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Macro from CustomTable View modes: 
User avatar
Member
Member
egarrison-wte - 11/7/2013 9:02:15 PM
   
Macro from CustomTable
Does anyone know the Macro syntax for pulling a field from a custom table? Or if it works right. I use macro's frequently, but the custom table has never seemed to worked.

I need to select 1 row, 1 field based on an ID passed to it. For some reason, I cannot seem to get the macro to pull via the customtable or customtable query. It is not the ID passing in, nothing seem to come back.

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 11/8/2013 1:25:29 AM
   
RE:Macro from CustomTable
Hi,

Thank you for your message.

For this you will need to create a Custom macro method. You can call this macro with giving it a parameter (some ID in your case) and in the code behind you will get the data out of your custom table and return the desired output.

For creating custom macro method please see: http://devnet.kentico.com/docs/devguide/index.html?registering_cutom_macro_methods.htm

And for managing custom table data: http://devnet.kentico.com/docs/devguide/index.html?custom_tables_api_examples_managing_custom_table_data.htm

Let us know if you need anything else.

Kind regards,

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 11/8/2013 6:15:50 AM
   
RE:Macro from CustomTable
What are you using for a query? Macro? The standard use of
{%ColumnName%}
works just fine for me in a webpart.

User avatar
Member
Member
egarrison-wte - 11/8/2013 8:05:08 AM
   
RE:Macro from CustomTable
FroggEye -
I am actually trying to populate the Meta title tag. I have 20K dynamic pages in Custom table. I am trying to pull the page name out of that table and populate it. As you can guess, right now I have 20K pages with the same page title on the site.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 11/8/2013 12:33:04 PM
   
RE:Macro from CustomTable
So I'm guessing you have your doc type connected to a custom table is that correct? Technically there isn't any metadata with custom table records because they aren't documents and dont' contain those same properties.

User avatar
Member
Member
egarrison-wte - 11/8/2013 1:32:00 PM
   
RE:Macro from CustomTable
The Document is just "Page (menu item)". Then from the custom table I am reading information to populate Basic Repeaters on the page. The pages information changes frequently and I have them being populated via SSIS package and nightly process. That is why they are not Tree nodes.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 11/11/2013 7:26:38 AM
   
RE:Macro from CustomTable
Unless I'm mistaken you'd have to create some custom macro/functionality for that to happen since you aren't storing the data as a doc type.

Although if you are using URL aliases you might be able to get the alias parameter info in the metadata simply by using what you entered in as your url alias parameter. For instance if your url alias is /Products/{productname}, just enter {%productname%} in the field which will get the url parameter for you.

User avatar
Member
Member
egarrison-wte - 11/12/2013 9:40:35 AM
   
RE:Macro from CustomTable
I will be doing a custom macro. I think that is the best. The product names in the URL would require me changing the URLs and potentially loosing some of the Google index rank. Thanks for the help.