Jump to content

Persistant variables


Go to solution Solved by water,

Recommended Posts

Hello,

Can someone please tell me why this isnt working or how to get this particular part working?

After ending this loop: For $masterRe = 1 To UBound($masterArray) -1

This variable content dissapears: $queueM1

For example, this part does not work:

If $match1 = "Yes" And $queueM1 = "US_L1_Call Center System Alerts" Or $queueM1 = "US_L1_Customer Support System Alerts" And Not ($statusM1 = "RETAILER STATUS") Then
        FileWrite($RF_Updates1, "Replace" & "," & $master_st & "," & $incidentID1 & "," & $incidentticket1 & "," & "Old Description" & "," & $descriptionM1 & "," & "New Description" & "," & $T_desc & @CRLF)
    EndIf

$dbday = StringReplace(_NowCalcDate(), "/", "-")
$sFilePath_list_master = @ScriptDir & "\master.xls"
$trendsreport = @ScriptDir & "\result-" & $dbday & ".csv"
$RF_Updates= @ScriptDir & "\RF_Updates.csv"
$RF_Updates1 = FileOpen($RF_Updates, 1)
$RF_New = @ScriptDir & "\RF_New.csv"
$RF_New1 = FileOpen($RF_New, 1)
Local $masterExO = _Excel_Open()
    Local $masterEx = _Excel_BookOpen($masterExO, $sFilePath_list_master)
    Local $masterArray = _Excel_RangeRead($masterEx, Default, $masterEx.ActiveSheet.Usedrange.Columns("A:K"), 1, True)

Local $trendArray
_FileReadToArray($trendsreport, $trendArray)
For $T = 2 To Ubound($trendArray) -1
    $T1 = StringSplit($trendArray[$T], ",")
    $T_st = StringRight($T1[1], 8)
    $T_desc = $T1[8]

    Local $match1 = "No"
    For $masterRe = 1 To UBound($masterArray) -1
    $incidentID1 = $masterArray[$masterRe][0]
    $incidentticket1 = $masterArray[$masterRe][1]
    $chainM1 = $masterArray[$masterRe][3]
    $queueM1 = $masterArray[$masterRe][10]
    $statusM1 = $masterArray[$masterRe][7]
    $descriptionM1 = $masterArray[$masterRe][5]
    $categoryM1 = $masterArray[$masterRe][6]
    $master_st = ""
        If Not ($chainM1 = "") Then
            $master_st = $masterArray[$masterRe][3] & "-" & $masterArray[$masterRe][4]
        ElseIf $chainM1 = "" And $queueM1 = "US_L1_Call Center System Alerts" Or $queueM1 = "US_L1_Customer Support System Alerts" Then
            $master_st = StringLeft($descriptionM1, 8)
        EndIf
        If $T_st = $master_st Then
            $match1 = "Yes"
        ;   MsgBox($MB_SYSTEMMODAL, '', $match1 & "-" & $T_st & "-" & $master_st )
        EndIf
        ;If $queueM1= "US_L1_Call Center System Alerts" Or $queueM1 = "US_L1_Customer Support System Alerts" Then MsgBox($MB_SYSTEMMODAL, '1', $queueM1 & "-" & $match1 & "-" & $queueM1 & "-" & $statusM1  )
    Next
    If $queueM1= "US_L1_Call Center System Alerts" Or $queueM1 = "US_L1_Customer Support System Alerts" Then MsgBox($MB_SYSTEMMODAL, '2', $queueM1 & $match1 & $master_st & "-" & $statusM1)
    ;MsgBox($MB_SYSTEMMODAL, '', $match1 & "-" & $queueM1 & "-" & $statusM1 )
    If $match1 = "Yes" And $queueM1 = "US_L1_Call Center System Alerts" Or $queueM1 = "US_L1_Customer Support System Alerts" And Not ($statusM1 = "RETAILER STATUS") Then
        FileWrite($RF_Updates1, "Replace" & "," & $master_st & "," & $incidentID1 & "," &  $incidentticket1 & "," & "Old Description" & ","  & $descriptionM1 & "," & "New Description" & "," & $T_desc & @CRLF)
    EndIf
    If $match1 = "No" And Not ($master_st = "") Then
        FileWrite($RF_New1, $trendArray[$T] & @CRLF)
    EndIf

        ;_ArrayDisplay($masterArray)
Next
Link to comment
Share on other sites

There is only a single line where this variable is being set.

$queueM1 = $masterArray[$masterRe][10]
So it seems that $masterArray[$masterRe][10] is empty.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Yes, thats correct - out of 50 thousand records, many of the time that cell will be empty - but occasionally it will have the values i'm looking for.

however it looks like after the 2nd loop ends, that variable, along with all the other variables from $masterArray[$masterRe] lose their values. Is this some sort of global, local, thing?

 

Does the logic look or seem correct?

Link to comment
Share on other sites

  • Solution

Variables do not lose their content. You either assign another value to them or you try to access the variable outside of its scope.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...