NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Breakdown ACCESS

---------------------------------------------------------
Countif(numbering) CC (B column)
and
Duplicates(pivot table) DD (C column)

........
Formulas (very slow) :

CC [B2] = Countif$(merge) = Countif(A2:A$500,A2)
DD [C2] = Countif$$(merge) = Countif(A$2:A$500,A2)



........
Static Method :

Sort merge AtoZ
CC [B2] = 1
CC [B3] = if(A3=A2, B2+1, 1)


Sort CC ZtoA
Sort merge AtoZ
DD [C2] = B2
DD [C3] = if(A3=A2, C2, B3)

---------------------------------------------
Procedure -

............................................
You have to update only 5 items -

id9, Kite

var arrName, arrCompanies, arrContacts
(in Macros)
(
arrName: Kite array
arrCompanies: Companies breakdown array
arrContacts: Contacts breakdown array
)
.............................................
Create [Kite] column :
if requirement is
[x1, x2, x3] no. of companies,
[y1, y2, y3] no. of contacts
for particular [Application] [Country] [State]
Then
Kite = Application&Country&State
var arrName = ["App1Country1State1", "App2Country2State2", "App3Country3State3"];
var arrCompanies = [367,517,433];
var arrContacts = [726,1404,1190];

.........................
Note1:
if only Contacts breakdown is required (Companies breakdown is not required)
Then goto Access,
Run Total SQL of "Available [Companies]",
use this breakdown in 'arrCompanies' array.

Note2:
if there is no breakdown but requirement is X number of Companies with Y number of Contacts
Then create [Kite] column, in [Kite] type "Z" for all cells,
update Macros-arrays:
var arrName = ["Z"],
var arrCompanies = [X no.]
var arrContacts = [Y no.]

.....................................
Add columns:
id9, Kite, FCC, merge, CC, DD, merge2,
merge3, Tep, Res, Fin

id9 = row()-1 ..............(Autonumber in ACCESS)
Kite = Application&Country&State

FCC = Countif(Company)
merge = Kite&Company

CC (merge), DD (merge)
merge2 = Kite&DD&Company


{ Import file to Access, update Macros-arrays, Ctrl+G, Run Macros, goto Excel file and vlookup id9 column of Access file (OR Export Access file to Excel) }

if Total Unique Companies are less than Total Required,
Then
filter (Res=blank, FCC=1) for P no. of records change Fin=blank to Fin=2
filter (Fin=1, CC=doesnotequal:1) for P no. of records change Fin=1 to Fin=blank


if Total Contacts are less than Total Required,
Then
filter (Fin=blank, Sort [DD] ZtoA, Sort [Res] ZtoA) for P no. of records change Fin=blank to Fin=2


---------------------------------------
Macros(ACCESS)[create Macros via JavaScript] -



var arrName = ["FIS", "IHS", "Simcorp"];
var arrCompanies = [367,517,433];
var arrContacts = [726,1404,1190];



document.body.textContent = ``;


document.body.insertAdjacentHTML("beforeend", `


Option Compare Text<br ><br ><br >

Private Sub ispGen()<br ><br ><br >

Dim db As Object<br >
Set db = CurrentDb<br ><br ><br >


db.Execute "ALTER TABLE [FINAL] ADD COLUMN [FCC] TEXT, " & _<br >
"[merge] TEXT, [CC] TEXT, [DD] TEXT, [merge2] TEXT, " & _<br >
"[merge3] TEXT, [Tep] TEXT, [Res] TEXT, [Fin] TEXT;"<br ><br >

MsgBox "Columns Added"<br ><br ><br >


db.Execute "SELECT FINAL.[Company Name], Count(FINAL.[Company Name]) AS [Company Count], First(FINAL.id9) AS id9Unique " & _<br >
"INTO FCCTB FROM FINAL " & _<br >
"GROUP BY FINAL.[Company Name];"<br ><br >


MsgBox "FCCTB table created"<br ><br ><br >


db.Execute "update FINAL,FCCTB " & _<br >
"set " & _<br >
"FINAL.FCC = '1' " & _<br >
"where " & _<br >
"FINAL.id9 = FCCTB.id9Unique;"<br ><br >


MsgBox "FCC Done"<br ><br ><br >


db.Execute "update FINAL " & _<br >
"set " & _<br >
"merge = Kite&[Company Name];"<br ><br >


MsgBox "merge Done"<br ><br ><br >


db.Execute "SELECT FINAL.merge, Count(FINAL.merge) AS mergeCount, First(FINAL.id9) AS id9Unique " & _<br >
"INTO mergeTB FROM FINAL " & _<br >
"GROUP BY FINAL.merge;"<br ><br >


MsgBox "mergeTB table created"<br ><br ><br >


db.Execute "update FINAL,mergeTB " & _<br >
"set " & _<br >
"FINAL.CC = '1' " & _<br >
"where " & _<br >
"FINAL.id9 = mergeTB.id9Unique;"<br ><br >

MsgBox "CC Done"<br ><br ><br >


db.Execute "update FINAL,mergeTB " & _<br >
"set " & _<br >
"FINAL.DD = mergeTB.mergeCount " & _<br >
"where " & _<br >
"FINAL.merge = mergeTB.merge;"<br ><br >


MsgBox "DD Done"<br ><br ><br >


db.Execute "update FINAL " & _<br >
"set merge2 = Kite&DD&[Company Name];"<br ><br >

MsgBox "merge2 Done"<br ><br ><br >

`);


for(var i=0; i<arrName.length;i++){

document.body.insertAdjacentHTML("beforeend", `

db.Execute "update ( " & _<br >
"select top ${arrCompanies[i]} Tep from ( " & _<br >
"select Tep,merge2 from final " & _<br >
"where CC = '1' and [Kite] = '${arrName[i]}' " & _<br >
"order by merge2 desc " & _<br >
")) as ss " & _<br >
"set ss.Tep = '1';"<br ><br >

`);
}

document.body.insertAdjacentHTML("beforeend", `
MsgBox "Tep (Unique Companies Breakdown) done"<br ><br ><br >

db.Execute "select merge2 into TB from final " & _<br >
"where Tep='1';"<br ><br >

MsgBox "TB table created"<br ><br ><br >


db.Execute "update final,TB " & _<br >
"set final.Res = '1' " & _<br >
"where " & _<br >
"final.merge2 = TB.merge2;"<br ><br >

MsgBox "Res done (Take from Res records)"<br ><br ><br >

db.Execute "update final " & _<br >
"set " & _<br >
"merge3 = Kite&Res&'C'&CC&'Z';"<br ><br >


MsgBox "merge3 done"<br ><br ><br >
`);



for(var i=0; i<arrName.length;i++){

document.body.insertAdjacentHTML("beforeend", `

db.Execute "update ( " & _<br >
"select top ${arrContacts[i]} Fin from ( " & _<br >
"select Fin,merge3 from final " & _<br >
"where [Kite] = '${arrName[i]}' " & _<br >
"order by merge3 " & _<br >
")) as vv " & _<br >
"set vv.Fin = '1';"<br ><br >

`);
}

document.body.insertAdjacentHTML("beforeend", `
MsgBox "Fin (Contacts Breakdown) done"<br ><br ><br >

db.Execute "DROP TABLE FCCTB, mergeTB, TB;"<br ><br >

MsgBox "Tables Dropped !"<br ><br ><br >


End Sub
`);




---------------------------------------
SQL(Access) -



update (
select top 100 Tep from (
select Tep,merge2 from final
where CC = '1' and [Kite] = 'FIS'
order by merge2 desc
)) as ss
set ss.Tep = '1'



select merge2 into TB from final
where Tep='1'

update final,TB
set final.Res = '1'
where
final.merge2 = TB.merge2



update final
set
merge3 = Kite&Res&'C'&CC&'Z'



update (
select top 200 Fin from (
select Fin,merge3 from final
where [Kite] = 'FIS'
order by merge3
)) as vv
set vv.Fin = '1'



*************************COUNTS START*****************************

....BREAKDOWN COUNTS
Query Design
Total
Kite(Group By), Kite(Count)
Edit SQL


....TOTAL COUNTS
SELECT Count(*) AS Expr1


....FROM
Verified [Companies]
Verified [Contacts]
Available [Companies]
Available [Contacts]




FROM (select distinct [company name],Kite from final where final.FIN='1')

FROM (select [company name],Kite from final where final.FIN='1')

FROM (select distinct [company name],Kite from final)

FROM (select [company name],Kite from final)


*************************COUNTS END*****************************



---------------TheEnd--------------











     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.