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:
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.$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++; }
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:
The string in $ifg->{parameter} is a comma delimited string containg the field names that get split into @map_fields.@map_fields = split ( ",", $ifg->{parameter} );
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.
In reply to Updating variables in Tk programmes by jdtoronto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |