Error: Object variable or With block variable not set

10 posts / 0 new
Last post
talebi
Offline
Joined: 11/23/2021 - 14:15
Error: Object variable or With block variable not set

Hi Brian,
 
Finally I have created my first pro dialog box in IDEA and that's amazing for my future projects.
I wanted to add benford law into the macros (dialog box) but i have got an error: Object variable or With block variable not set!
Please have a look at the attached pic.
Also, some tables may have less than 1000 puplulation so I will receive an error if the number of records is less than 1000 for creating suspicious.
That would be great if you let me know how to script the number of records e.g.
 
if "number of population" <1000 then eqn = "number of population"
task.MinimumRecordsForCreatingSuspicious = eqn
 
Thanks,
 

Images: 
Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

In the lower right hand corner you can find the line number you are on:

Let me know what line it is that it is pointing to.

talebi
Offline
Joined: 11/23/2021 - 14:15

Thanks for your response.
Line: FIRST1DIGIT_ANALYSIS = 1

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

I see what your problem is, you need to be defining all those variables as Integer and not what you are doing.  So:

Dim FIRST1DIGIT_ANALYSIS as FIRST1DIGIT_ANALYSIS 

should be:

Dim FIRST1DIGIT_ANALYSIS as Integer

There is no variable type called FIRST1DIGIT_ANALYSIS and that is why you are getting that error.

talebi
Offline
Joined: 11/23/2021 - 14:15

Thanks Brian!!!
How about my second question about the number of records in a table

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Sorry, I missed that question.

The db.count will give you the number of records in a file.

talebi
Offline
Joined: 11/23/2021 - 14:15

Thank you very much

talebi
Offline
Joined: 11/23/2021 - 14:15

Hi Brian, I was wondering if I could write a script to export the benford's bar charts. You helped me to write scripts to create benford law for a database but I also need to export the bar charts along with the tables. Please have a look at the picture I have attached.

Images: 
Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi talebi, unfortunately you can't export the image using IDEAScript.  The best you could probably do is export the data to Power BI or Excel and then recreate the chart in those apps.

talebi
Offline
Joined: 11/23/2021 - 14:15

Thanks