Forums

DB Record Loader with No Primary Key

gabedaly 01 Sep, 2011
Is there anyway to display record data without a primary key? I have a joined table that can't have a primary key and would love to use Chronoforms to display some of the data in this table. By the way. V2.0 is great! Max added a good amount of cool features. Thanks, Gabe
GreyHead 02 Sep, 2011
Hi Gabe,

You can always use a Custom Code block to query the tables and display the result.

Bob

PS So what new features are in RC2.0? I haven't found time to install it yet :-(
gabedaly 04 Sep, 2011
I haven't played around with it too much yet but there is a way to display DB records without needing to know html😀 plus a lot of other improvements like check boxes can be displayed vertically, etc..

Bob, can you provide us with the code to fetch a particular table in the Joomla default database? Also, when using the custom code for this, can I still use the DB Record Loader to help me display the info from the called table or will I need to insert custom html to display it?

Thanks,
Gabe
GreyHead 04 Sep, 2011
Hi Gabe,

Not sure of the question . . .

Here's how to do it with the CFv4 RC2.0 data display:
[list=a]
  • Drag a DB Multi Record Loader action to the On Load event

  • On the Basic tab select the #__contents table (no longer jos_contents in Joomla! 1.7, mine is g9tu4_contents)

  • On the Data Displayer tab Enable the Data Displayer

  • Add a list of column names in the Display Fields box - I used id,title

  • Set the Pagination to Bottom; and the Limit to say '10'
  • [/list:o]

    Here's the result:
    [attachment=0]04-09-2011 16-29-10.png[/attachment]

    Bob
    gabedaly 04 Sep, 2011
    Thanks Bob. I understand how to do that but my issue is that way will only work if the table has a primary key. If I try to use it with a joined table it will not display any data. I was wanting to display the data (with the DB Record loader since I am no good at html or any code for that matter) from a joined table that has no primary key. Hope that clears it up some.

    BTW 2.0 is pretty cool huh?
    Max_admin 09 Sep, 2011
    Hi Gabe,

    I don't think this is doable because of some Joomla database class limitation or something I don't know, but I can't remember that I got Joomla to connect to a table with no primary key, I believe this is mandatory.

    So why not just add a dummy auto increment primary key for your table ? you can do this in 2 seconds in PHPmyadmin

    Regards,
    Max
    Max
    ChronoForms developer...
    Did you try ChronoMyAdmin for managing your Joomla database tables ?
    gabedaly 09 Sep, 2011
    Thanks Max. I tried to put an auto increment in a new column but it won't let me because it is a joined table. I was however able to get the Multi DB Recordloader to display the info from it. It took a while of playing around but it does display from the joined table😀 . Is there any way to change the way the Multi record loader displays the column headings? Right now I have a column in the table called "accountnumber". It would be great if I can get to say "Account Number" instead. I know that this is not directly related to CF so I wouldn't be offended if you didn't want to work on this. Thanks guys for your continued support.
    Gabe
    Max_admin 10 Sep, 2011
    Hi Gabe,

    I'm glad you got it working!🙂

    Are you using the data displayer in the action ? how it it configured ? can you show me a screenshot ?

    Regards,
    Max
    Max
    ChronoForms developer...
    Did you try ChronoMyAdmin for managing your Joomla database tables ?
    gabedaly 14 Sep, 2011
    Hey Max,

    Not good with screen shots. But here's how I have it set up.
    I have no Fields in the "Preview" area but on the "events" tab I have the following

    On Load Area
    The DB Multi recordloader is located within an "Allowed" Authentication event followed by the Show HTML under that (also within the allowed area).

    The Basic tab in the DB Multi Record Loader looks like this
    DB Field:
    Table: my joined table
    Model Id:
    Fields:

    In the Advanced tab I have the following
    Load Data: Yes
    Enable Associations: No
    Associated Models:
    Group Model Data: No
    Where Box:
    <?php
    $user = &JFactory::getUser();
    echo "userid = ".$user->id
    ?>

    (userid is one of my fields that mimics the Joomla user id)

    In the Data Displayer tab I have the following
    Enable: Yes
    Display Fields: a few of my field names separated by comma
    Order Fields:
    Enable Pagination: No
    Limit: 50

    I have nothing on the "On Submit"

    That's it. It works just fine. I opted not to use though simply due to the way the field names are displayed. But it is a great tool for some that need it. Great job Max!😀
    glouckx 13 Oct, 2012
    Lo que Ud debe hacer es entrar al formulario en Wizzard Mode y en Actions realizar lo siguiente:

    1º Eliminar la acción DBSave.
    2º Aplicar los Cambios
    3º Volver a crear la acción DBSave y configurarla.
    4º Guardar y en el caso que corresponda, borrar la caché de Joomla.

    Listo!

    Google translation:
    What you should do is go to form Wizzard Actions Mode and do the following:

    Remove 1 DBSave action.
    2nd Apply Changes
    Recreate 3rd DBSave action and configure it.
    4 Save and if appropriate, clear the cache of Joomla.

    Ready!
    This topic is locked and no more replies can be posted.