This topic is locked

Printing a multi-select field - only getting one choice printed

6/23/2006 7:35:57 PM
PHPRunner General questions
D
Dale author

I had posed this question once before and now it has come to bite me again.
I have a drop down wizard field based on a table. In the wizard I have flagged it to Use table for values but show Name on display, and store the record number in the database field.
Do so all works fine, except when I go to print the selected items. Having the link field and the display field different, breaks the printout of the selected items.
I was told I could correct the problem by making the database field larger and store the selected Names in the field instead of the linked field value.
That does work.
BUT, the issue I have is

  1. The waste of space in storing the Name(s) in the field. I can get 10 selects in a field using the record number link field rather than storing the NAME data (which could be 100 characters each).
  2. If I do adopt the above method, and for whatever reason I change the Name, opening an older record with the old name of course will not resolve to the picklist build by phprunner.
    I really need a fix for this.

    I need to store the link field values in the field, yet print ALL the selected Names relating to the link values stored in the database field.
    It does print the first selected field correctly, and then stops so I only get the first Name of the multi select choices saved. Opening the record for editing, works perfectly.
    Is there something I can fix to get ALL the printed selected Names when printing.

    Please.

    Any suggestions would be greatly appreciated.
    Below is the actual snippet produced by phprunner for the Multi select field in question.
    echo "<tr><td>&nbsp;</td><td>&nbsp;</td><td>";

    $iquery="field=".array_search("components",$fieldlist)."&key=".htmlspecialchars($data[$strKeyField]);

    if($strKeyField2)

    $iquery.="&key2=".htmlspecialchars($data[$strKeyField2]);

    if($strKeyField3)

    $iquery.="&key3=".htmlspecialchars($data[$strKeyField3]);

    ?>
    <?php

    if(IsBinaryField($rsData,"components"))

    {

    $value=db_stripslashesbinary($data["components"]);

    $fileinfo="";

    $itype=SupposeImageType($value);

    if($itype)

    $disp='<img border=0 src="purchases_imager.php?'.$iquery.'">';

    else

    {

    if(strlen($value))

    {

    $disp='<img border=0 src="images/file.gif">';

    $fileinfo=' ('.strlen($value).' bytes)';

    }

    else

    $disp='<img border=0 src="images/no_image.gif">';

    }

    if(!"" || !($filename=$data[""]))

    $filename="file.bin";

    else if($fileinfo)

    $fileinfo=" ".$filename.$fileinfo;

    if(Format("components")==FORMAT_DATABASE_FILE)

    echo '<a href="purchases_getfile.php?filename='.htmlspecialchars($filename).'&'.$iquery.'".>'.$disp.'</a>'.$fileinfo;

    else

    echo $disp;

    }

    else

    {

    if(strlen($data["components"]))

    {

    $strdata = make_db_value("components",$data["components"]);

    $LookupSQL="SELECT concat(name) FROM `components` WHERE `component_id` = " . $strdata. " and (". " 1=1 ".")";

    LogInfo($LookupSQL);

    $rsLookup = db_query($LookupSQL,$conn);

    if($lookuprow=db_fetch_numarray($rsLookup))

    echo ProcessLargeText($lookuprow[0],"","",MODE_PRINT);

    else

    echo ProcessLargeText(GetData($rsData,$data,"components", ""),$iquery,"",MODE_PRINT);

    }

    }

    echo "</td><td>&nbsp;</td></tr>";

    ?>
    Thankyou in advance for any suggestions to get this working. My client is pressuring, what else is new!

D
Dale author 6/26/2006

Help,

I was looking forward to viewing a solution but alas no answer for my issue.
The experience of the PHPRunner staff has expertly been able to answer all my issues, so I was sure they could help me out here.
If it cant be done to Print all Display as Options for a lookup wizard while storing their corresponding Link As value in the database, then maybe I could get a code snippet that would check the existing records and update the name value if it has been changed.
ie.
I have a Industry Type table

id = 10 industry_type = Construction

id = 20 industry_type = Retail

id = 99 industry_type = Marketing
I have a customer table.

Industry field is a lookup wizard linked to the Industry_type table. (multi-line select)
If for whatever reason the admin changes the industry_type on a record in the Industry_type table from Marketing to Marketing/Advertising,
What snippet would I need in the After Edit Event for the industry_type table, to check all Customer records who have Industry as one of the selected values and update the old industry_type Marketing to the new value of Marketing/Advertising. So after the edit, the code has to check ALL the values stored in the multi-line Link field and update it accordingly.
This cascading of changes to other records would allow me then to use the Link field and Display field the same as earlier suggested using the lookup wizard. ( Although this still increases the size of the stored data because I would not be storing the much shorter id value )
A solution to print all selected values while using the Link field (record id) and Display field as (name) would still be the most suitable.
But Im behind the gun, and the cascading update would help solve my issue.

Alexey admin 6/27/2006

Dale,
unfortunatelly PHPRunner supports mult-select lookups only if Link and Display fields are the same.
There is no easy way to make it working with different Link and Display fields.