Esteemed monks,

I have had a similar problem to this before, and I am still not sure how to fix it in this case.

@map_fields is declared as a global variable. It isused to hold the variable from each of a number of BrowseEntry's which are created like this:

$cnt2 = 0; my $dbfields = $dbh->selectcol_arrayref ("SHOW COLUMNS FROM lead") +; push ( @$dbfields, 'SKIP'); foreach my $field ( @file_fieldnames ) { $pg->Label(-relief => 'sunken', -width => 15, -text => $field) +->grid(my $brb = $pg->BrowseEntry(-variable => \$map_fields[$cnt2])); $brb->insert('end', @$dbfields); $cnt2++; }
My goal is to map the fields that are in a text file I am importing (which are variable in number and in order), to the fields in the database table. The array referenced by $dbfields gets a list of the fields in the table. When it is selected it is saved in the appropriate slot in @map_fields.

I have a db table which also stores preset configurations (user can also store his own). When I load a configuartion from the database and 'split' the string into the array like this:

@map_fields = split ( ",", $ifg->{parameter} );
The string in $ifg->{parameter} is a comma delimited string containg the field names that get split into @map_fields.

Then I do not see the new values in the BrowseEntry's. The @map_fields array can be used to do the field mapping alright (I use the two array's to build an SQL query that ALTER's the field names in a temp table, then I append the resulting table to the table I want to import the file into).

Can anyone offer a suggestion as to how I get the new values to show up in the BrowseEntry's??

Your help is much appreicated.

jdtoronto


In reply to Updating variables in Tk programmes by jdtoronto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.