Jump to content
nooneclose

[SOLVED] How to check if a field that can be created but wasn't exists?

Recommended Posts

Good morning, I am trying to figure out if it is possible to check if these invoice lines exist or not. 

Here are the table and column name: INVOICELINE.INVOICELINENUM (a required field if created)

Here is a picture of what I am talking about. (Do not worry about security. the picture is from a demo test site so all information is fake)

 2136520946_Screenshot(90).thumb.png.ceb98377b3e98e6f1fe688f2bb1cb429.png

is there any way to check if these fields exist or not? (they do not exist unless the user clicks on "New Row")

Example: line 11 does not exist right now. How would I go about to see if it did or not? 

This is what I have so far:

SELECT DISTINCT iv.invoicenum, iv.description
FROM invoice     AS iv
JOIN invoiceline AS ivl ON iv.invoicenum = ivl.invoicenum AND iv.siteid = ivl.siteid 
/* = 'nothing' and yet somehow not null? */
WHERE iv.invoicenum NOT IN (SELECT invoicelinenum FROM invoiceline WHERE invoicelinenum IS NOT NULL)

I get 0 results where I should get more than 0. 

Edited by nooneclose
Solved

Share this post


Link to post
Share on other sites
6 minutes ago, nooneclose said:

WHERE iv.invoicenum NOT IN (SELECT invoicelinenum FROM invoiceline WHERE invoicelinenum IS NOT NULL)

You're comparing invoicenum and invoicelinenum that is oranges and shoes.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Solved it. The only problem is that they "don't exist" without a line number. The code does work its just a database issue at this point. 

Like always here is the final code:

SELECT distinct invoicenum, description
FROM invoiceline 
GROUP BY invoicenum, description  
HAVING SUM(invoicelinenum) < 1
ORDER BY invoicenum

 

Share this post


Link to post
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

  • Similar Content

    • By v120
      Rapid Fire Mouse Hack Script
      *snip*
       
    • By Kruxe
      Hello Everyone,
      I am very green when it comes to AutoIT, I have recently started using it to automate a job that i perform using MS Excel and that is working great. Recently I have been faced with a challenge I which i need to copy a specific set of lines from one .txt file and past them, overwriting a specific set of lines in a different .txt file. I honestly have no clue how I can copy the specified lines and transfer them. What functions / commands could I use and how could I lay them out I AutoIT? Any and all help will be appreciated. 
      Thanks!
      Kruxe
    • By Saravanan2213
      Hi everyone,
      i just need your help. i have script for cleaning browsing history and other unwanted file but the problem is i don't want to see the GUI i have attached below. It should not show anything on the screen. is it possible to do it in autoit. thanks in advance.
       
      So for i have tried flag
      Run("rundll32.exe InetCpl.cpl,ClearMyTracksByProcess 255", "", @SW_HIDE)
      @SW_DISABLE
       
      Looking forward your help.........

    • By cptHark
      Hello I want to conect to a Network with DriveMapAdd.
      This worked just fine but when you restart the Computer the Mapped drive is gone.
      So i used the persistent mapping flag and that seemed to work, too.
      However when the Computer is restarted I cant connect to the Network because it doesnt remember the Username and password I ave it the first time.
      How do I fix this?
      My Code:Func
      setdrivem()
          DriveMapAdd("M:", GUICtrlRead($driveM),1, GUICtrlRead($netzuser),GUICtrlRead($netzpassword) )
      EndFunc
      $netzuser and $netzpassword are set earlier in the gui and it works right after executing the script but i want it to stay connected
    • By nooneclose
      Morning, I am wondering is there is a way to prevent a script from ending/crashing when a "Subscript used on non-accessible variable" error occurs? 
      Here is some of my code:
      $aItems = _OL_ItemFind($oOutlook, $mFolder[1], $olMail, "[UnRead]=True", "Subject", "Maintenance Request", "EntryID,Subject", "", 0) If @error Then Sleep(2000) LoopUnreadEmails() ;Exit MsgBox(48, "", "@error = " & @error & ", @extended: " & @extended & " at line: " & @ScriptLineNumber) EndIf Error Msg:
      (371) : ==> Subscript used on non-accessible variable.: $aItems = _OL_ItemFind($oOutlook, $mFolder[1], $olMail, "[UnRead]=True", "Subject", "Maintenance Request", "EntryID,Subject", "", 0) $aItems = _OL_ItemFind($oOutlook, $mFolder^ ERROR I know that error occurs very rarely and at random. But like with most errors "in this case" I can use recursion to fix it. 
      I just recall the function and it will and has fixed itself. But this "Subscript used on non-accessible variable" just ends the script.
      Like I said before, is there a way to allow the script to keep running or call a function when this error occurs instead of just ending?   
×
×
  • Create New...