Jump to content

How can i Erase/Empty/Clear the value inside a variable


Recommended Posts

How can i Erase/Empty/Clear the value inside the variable because the value of my variable keep on accumulating, i have an input box then it saves the value in a variable, and when i enter other data in the input box it saves together with the priviews value, I want my variable overite the value when ever i input a new data in my input box. thanks in advance.

Link to comment
Share on other sites

Can you please post the code you use? From your post it is impossible to see where the problem is.

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

this is the function

Func _addButtonAT()
If GUICtrlRead($aCID) = "" Then
   MsgBox(0, "No Input ", $cid)

Else
  _SQLite_Startup()
  $db = _SQLite_Open($dbfile)
  $createddate = _NowDate() & " " & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC) ;10
  If StringInStr($createddate, "-") Then
   $createddate = StringReplace($createddate, "/", "-")
  EndIf
  ;to select a specific default format
  $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW
  $style = "M/d/yyyy HH:mm:ss"
  GUICtrlSendMsg($occaDate, $DTM_SETFORMAT_, 0, $style)
  $cid = StringReplace(StringReplace(GUICtrlRead($aCID), "'", ""), "|", "") ;1
  $sql = 'select * from record where ChurchID like "%' & $cid & '%" order by ChurchID, FullName;'
  $ret = _SQLite_GetTable2d(-1, $sql, $aResult, $nbrows, $nbcols)
  $crtime = _NowTime()
  $dif = StringReplace(StringReplace(GUICtrlRead($occaDate), "'", ""), "-", "") ;1
  $ret1 = 'SELECT NO FROM record WHERE ChurchID like "' & $cid & '" ;'
  _SQLite_QuerySingleRow($db, $ret1, $aRow)
  $ret2 &= $aRow[0] ; output1             ; get the value of NO
  $ret3 = 'SELECT ChurchID FROM record WHERE NO like "' & $ret2 & '" ;'
  _SQLite_QuerySingleRow($db, $ret3, $aRow)
  $ret4 &= $aRow[0] ; output2             ; get the value of ChurchID
  ;_SQLite_QuerySingleRow(-1, "SELECT ChurchID FROM record LIMIT 1", $aRow)
  _GUICtrlListView_DeleteAllItems($cRecord)
   $sMsg1 = $ret2
   $sMsg2 = $ret4  
  If $cid = $ret4 Then
   $ret5 = 'SELECT FullName FROM record WHERE ChurchID like "' & $ret4 & '" ;'
   _SQLite_QuerySingleRow($db, $ret5, $aRow)
   $ret6 &= $aRow[0] ; output3            ; get the value of FullName
   $ret7 = 'SELECT Gender FROM record WHERE FullName like "' & $ret6 & '" ;'
   _SQLite_QuerySingleRow($db, $ret7, $aRow)
   $ret8 &= $aRow[0] ; output4            ; get the value of Gender
   $ret9 = 'SELECT Status FROM record WHERE Gender like "' & $ret8 & '" ;'
   _SQLite_QuerySingleRow($db, $ret9, $aRow)
   $ret10 &= $aRow[0] ; output5          ; get the value of Status
   $fname = $ret6
   $bGen = $ret8
   $bStat = $ret10
   If $createddate <= $dif Then
    $Due = "In Time"
   Else
    $Due = "Late"
   EndIf
   ;MsgBox(0, "Char From $createddate", $createddate)
   ;MsgBox(0, "Char From $dif", $dif)
   ;MsgBox(0, "Char From $Due", $Due)
   MsgBox(0, "Char From $cid = input box", $cid)
   MsgBox(0, "Char From $ret2 = Value of NO", $ret2)
   MsgBox(0, "Char From $ret4 = Value of ChurhID", $ret4)
   MsgBox(0, "Char from $ret6 - Full Name", $ret6)
   MsgBox(0, "Char from $ret8 - Gender", $ret8)
   MsgBox(0, "Char from $ret10 - Status", $ret10)
   ;MsgBox(0, "Char from $ret12", $ret12)
   ;MsgBox(0, "Char from $ret14", $ret14)
   ;MsgBox(0, "Char from $ret16", $ret16)
   ;MsgBox(0, "Char from $ret18", $ret18)
   ;MsgBox(0, "Char from $ret20", $ret20)
   MsgBox(0, "Char from $aResult", $aResult)
   _SQLite_GetTable2d($db, "SELECT * from battendance;", $bResult, $brow, $icolumn) ;
   _SQLite_Exec($db, "INSERT INTO battendance(ChurchID,FullName,Gender,Status,Due,DateLogin) VALUES ('" & $cid & "','" & $fname & "','" & $bGen & "','" & $bStat & "','" & $Due & "','" & $createddate & "');") ; INSERT Data
   ConsoleWrite("! identical !" & @CRLF)
   MsgBox(0, "This ID SUCCESSFULLY LOGIN: ", $cid)
;  _GUICtrlListView_DeleteAllItems($cRecord)

  Else
   _SQLite_GetTable2d($db, "SELECT * from battendance;", $bResult, $brow, $icolumn) ;
   _SQLite_Exec($db, "INSERT INTO battendance(ChurchID,Due,DateLogin) VALUES ('" & $cid & "','" & $Due & "','" & $createddate & "');") ; INSERT Data
   ConsoleWrite("ID NOT FOUND" & @CRLF)
   MsgBox(0, "This ID not FOUND: ", $cid)
   ;MsgBox(0, "Char From $createddate", $createddate)
   ;MsgBox(0, "Char From $dif", $dif)
   ;MsgBox(0, "Char From $Due", $Due)
   MsgBox(0, "Char From $cid = input box", $cid)
   MsgBox(0, "Char From $ret2 = Value of NO", $ret2)
   MsgBox(0, "Char From $ret4 = Value of ChurhID", $ret4)
   MsgBox(0, "Char from $ret6 - Full Name", $ret6)
   MsgBox(0, "Char from $ret8 - Gender", $ret8)
   MsgBox(0, "Char from $ret10 - Status", $ret10)
   ;MsgBox(0, "Char from $ret12", $ret12)
   ;MsgBox(0, "Char from $ret14", $ret14)
   ;MsgBox(0, "Char from $ret16", $ret16)
   ;MsgBox(0, "Char from $ret18", $ret18)
   ;MsgBox(0, "Char from $ret20", $ret20)
   ;MsgBox(0, "Char from $aResult", $aResult)
;  _GUICtrlListView_DeleteAllItems($cRecord)
 
 
  EndIf

; guictrlcreatelabel($sMsg4,180,195,320,30,$SS_CENTER)
; GUICtrlSetFont(-1, 20, 40, 0, $mFont)
;guictrlcreatelabel($sMsg8,180,225,320,30,$SS_CENTER)
;GUICtrlSetFont(-1, 20, 40, 0, $mFont)
GUICtrlSetData($set1, $sMsg2)
 
  _ArrayDisplay($aResult)
  _SQLite_GetTable2d($db, "SELECT * from battendance;", $bResult, $brow, $icolumn) ;
;  _GUICtrlListView_DeleteAllItems($attendance)
  _ArrayDisplay($bResult)
  _SQLite_Close()
  _SQLite_Shutdown()
  ;guictrlsetdata($iSearch,"")
  ;guictrlsetstate($iSearch,$GUI_FOCUS)
  _updateViewAT()
EndIf
EndFunc   ;==>_mCGIattendanceAT
Link to comment
Share on other sites

The $ret1 to $ret10 are the variable i need to overite the value every time i type in the input box.

"This is my input box"

$aCID = GUICtrlCreateEdit("", 15, 345, 308, 41, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_UPPERCASE))

GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)

GUICtrlSetFont(-1, 20, 400, 0, $mFont)

GUICtrlSetLimit(-1, 25)

GUICtrlSetTip(-1, "Type in your church ID or your Fullname")

"This is where i display the value of the variable"

$set1 = GUICtrlCreateLabel("", 25, 105, 320, 30, $SS_CENTER)

GUICtrlSetFont(-1, 20, 40, 0, $mFont)

"This $ret4 is my variable that out put the value i needed"

_SQLite_QuerySingleRow($db, $ret3, $aRow)

$ret4 &= $aRow[0] ; output2 ; get the value of ChurchID

"this another variable"

$sMsg1 = $ret2

$sMsg2 = $ret4

"This will send the value of the variable to be display in my GUI"

GUICtrlSetData($set1, $sMsg2)

Edited by reybol7
Link to comment
Share on other sites

reybol7,

put the code inside [<autoit] and [/autoit] tags(w/o the "<") so that it appears in a friendly readable manner as what it appears in scite.

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

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...