SQL left JOIN - HOW TO ACHIEVE IT THROUGH AHK

Get help with using AutoHotkey and its commands and hotkeys
sv270190
Posts: 45
Joined: 06 Feb 2014, 11:48
Facebook: [email protected]

SQL left JOIN - HOW TO ACHIEVE IT THROUGH AHK

05 Feb 2017, 11:24

TWO FILES ARE THERE

F1.TXT

AC|NAME
1|RAM
2|RAHIM
3|ROBERT
4|guru
5|raju

F2. TXT

AC|AMOUNT
1|100
2|200
3|300

WHAT I WANT TO ACHIEVE

F3.TXT

AC|NAME|AMOUNT
1|RAM|100
2|RAHIM|200
3|ROBERT|300
4|guru|
5|raju|

I could achieve the following:

AC|NAME|AMOUNT
1|RAM|100
2|RAHIM|200
3|ROBERT|300

through this code


#SingleInstance FORCE
filedelete, f0*.txt
Loop, Read, F1.TXT
{
f1line := A_LoopReadLine
StringSplit, z, f1line,|
; msgbox %z1%%z2%%z3% ; so far ok

loop, read,f2.txt,f03.txt
{
var1 =
f2line := A_LoopReadLine
stringsplit,y,f2line,|
if y1 = %z1%
{
var1 = %y1%|%y2%

fileappend,%var1%|%z1%|%z2%`n
}
}


}

return



your help will be highly appreciated
S.V. SRINIVASAN
SRIVILLIPUTTUR
TAMIL NADU
HotKeyIt
Posts: 2130
Joined: 29 Sep 2013, 18:35
Contact:

Re: SQL left JOIN - HOW TO ACHIEVE IT THROUGH AHK

05 Feb 2017, 15:16

Code: Select all

F1=
(
AC|NAME
1|RAM
2|RAHIM
3|ROBERT
4|guru
5|raju
)
F2=
(
AC|AMOUNT
1|100
2|200
3|300
)
oF1:=[]
oF2:=[]
Loop,Parse,F1,`n,`r
   If A_Index=1
      F3:=A_LoopField
   else
      o:=StrSplit(A_LoopField,"|"),oF1[o.1]:=o.2

Loop,Parse,F2,`n,`r
   If A_Index=1
      F3.=SubStr(A_LoopField,InStr(A_LoopField, "|")) "`r`n"
   else
      o:=StrSplit(A_LoopField,"|"),oF2[o.1]:=o.2

for k,v in oF1
   F3.=k "|" v "|" oF2[k] "`r`n"

F3:=RTrim(F3,"`r`n")

MsgBox % F3
sv270190
Posts: 45
Joined: 06 Feb 2014, 11:48
Facebook: [email protected]

Re: SQL left JOIN - HOW TO ACHIEVE IT THROUGH AHK

06 Feb 2017, 21:02

Good. It works.
But sir I could not understand your code
What why
What should I read?
Arrays / objects ??
S.V. SRINIVASAN
SRIVILLIPUTTUR
TAMIL NADU
sv270190
Posts: 45
Joined: 06 Feb 2014, 11:48
Facebook: [email protected]

Re: SQL left JOIN - HOW TO ACHIEVE IT THROUGH AHK

06 Feb 2017, 21:02

Thank you
S.V. SRINIVASAN
SRIVILLIPUTTUR
TAMIL NADU
sv270190
Posts: 45
Joined: 06 Feb 2014, 11:48
Facebook: [email protected]

Re: SQL left JOIN - HOW TO ACHIEVE IT THROUGH AHK

06 Feb 2017, 21:06

Thank you
Could you convert this as function
For eg
AHK_LEFT_JOIN(F1, F2, F1C, F2C)
S.V. SRINIVASAN
SRIVILLIPUTTUR
TAMIL NADU

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], Rohwedder and 48 guests