cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to run a query with one parameter in a VBA Macro

ingriva
Contributor

Hi.

Query name is  EA_LISPA_SB_DIREZIONE_LISPA_BS

Query code is

 

Select [Attore]
Where ([Composto].[Nome] Deeply = "97_Organizzazione LISPA::LISPA" And [Tipo-Attore] ="S") And
[Owns And Governs]:[Business Service] = &"bs"

 

VBA macro

Const maCodiceQuery1 = "~ZIXaICfyheJ0[_Select]"
Const IDQueryStrutture = "~SHdazOw1SjPT[EA_LISPA_SB_DIREZIONE_LISPA_BS] "
Const maNomeBreve1 = "~Z20000000D60[Nome breve] "

Set oQueryStruttureLispa = oRoot.GetObjectFromID(IDQueryStrutture)
Set oAttoreStrutturaLispa = oRoot.GetSelection(oQueryStruttureLispa.GetProp(maCodiceQuery1))

 

Question is

How can I pass the &"bs" query parameter in VBA?

Thanks

Marco

2 Replies

imran_khatyan
MEGA Partner
MEGA Partner

Well if your heart is set on Mega Defined queries, I know there could be a better way but following might help:

 

set q = (getRoot.getSelection("select query")("~weXNBzL3Sj4P[orgprocess]"))
qs = q.getProp("~ZIXaICfyheJ0[Select]")
set p = q.getCollection("~fr2tZ3UHxq10[Parameter]")(1)
vname = p.shortname
vid = p.getProp("_idabs")
rep = "&~"& vid &"{V}[""" & vname & """]"
print REPLACE("""" & qs & """",rep,"""test""")

Sashidhar
Super Contributor

You can write Dynamic query 


Ex " Select [Business Process] Where [_HexaIdAbs]='"&VariableObject.GetProp("_HexaIdAbs")&"' "