Search code examples
mysqlperlmks-integrity

Read Variable from Integrity, and get it with perl to sql


I'm using PTC Integrity at my firm. Here we have an Excel file which I need to transfer to our SQL Database with a Perl script.

In Integrity itself, there is a number for a Member Revision. I can see this Revision Number when I type:

echo %MKSSI_REVISION1%

in the command line. I tried to write this in Perl, but it's really hard for me. The Perl script should look for the Excel file Database.xlsx in the path C:\Integrity_Sandbox\Database\Database.xlsx, then read the Member Revision number, and write this number to my SQL Database.

Does anyone have any ideas on how I can manage to do this?

Edit Solution:

my @result = `si revisioninfo --project=/Database/project.pj ´Database.xlsm`; 
my $integrity_version = @result[2];
chomp $integrity_version;
my @fields = split(/: /,$integrity_version);
$integrity_version = @fields[1];
 chomp $integrity_version;

Solution

  • Bodaggnmo solved his problem with the following Perl code:

    my @result = `si revisioninfo --project=/Database/project.pj ´Database.xlsm`; 
    my $integrity_version = @result[2];
    chomp $integrity_version;
    my @fields = split(/: /,$integrity_version);
    $integrity_version = @fields[1];
    chomp $integrity_version;