‎15-10-2015 02:38 PM
Hi,
I build a macro who generate a particular SELECT ... where [Date de modification] < sysdate - 15 days
and I need to use this select in the [Component= ...] tag on an HTML description
thank's for your help
JFF
Solved! Go to Solution.
‎20-05-2020 06:22 PM
It can be done in different ways, but the best way for you would be to see some of the existing queries (that are based on macroes). If you execute the following query you get the queries. In the properties of each query you can see the macro, you see the classes etc.
Select [Query] Where [Collection Implementation]
‎20-05-2020 05:31 PM
How can a query be based on a VB script macro?
Which variable needs to be used to achive that?
‎13-11-2015 09:46 AM
correction of the macro to include the context : mgobjObj.GetObjectPicture(Ctx)
'MegaContext(Fields,Types) 'Uses(WEBUtilities) Option Explicit ' used to generate a HTML page ' strOut must return a valid HTML Page Dim sValue Dim Dt Dim Dm Dim Intit Sub Generate (mgobjObj As MegaObject,Ctx As MegaWebSite,strIn As String,strOut As String) sValue = mgobjObj.GetProp("Date de modification") Dt=mid(sValue,9,2) & "/" & mid(sValue,6,2) & "/" & mid(sValue,1,4) Dm=CDate(Dt) if Dm >= date()-10 then Intit = mgobjObj.GetProp("Nom court","Display") if strIn = "Diagramme" then if instr(mgobjObj.GetProp("Nom"),"(") > 0 then Intit = mid(mgobjObj.GetProp("Nom"),1,instr(mgobjObj.GetProp("Nom"),"(") -1 ) else Intit = "" end if end if if Intit <> "" then strOut= "<TR><TD><img src=" & chr(34) & mgobjObj.GetObjectPicture(Ctx) & chr(34) & "/> <a href=" & chr(34) & Lcase(mgobjObj.GetProp("_HexaIdAbs")) & ".htm" & chr(34) & " target=" & chr(34) & "_top" & chr(34) & "> " & Intit & "</a></TD> <TD>" & Dm & "</TD>" & "</TR>" end if end if End Sub
‎16-10-2015 04:58 PM
Hello,
to solve my problem , I made the following
Descripion :
\n [Component="Select [Processus métier]" Sorter="Nom court:A"] \n [ExternalCall Macro="Select_Object"]PM[/ExternalCall] \n [/Component] \n [Component="Select [Processus organisationnel]" Sorter="Nom court:A"] \n [ExternalCall Macro="Select_Object"]PO[/ExternalCall] \n [/Component] \n [Component="Select [Opération]" Sorter="Nom court:A"] \n [ExternalCall Macro="Select_Object"]Opération[/ExternalCall] \n [/Component] \n [Component="Select [Diagramme]" Sorter="Nom:A"] \n [ExternalCall Macro="Select_Object"]Diagramme[/ExternalCall] \n [/Component]
Macro (Format HTML)
'MegaContext(Fields,Types) 'Uses(WEBUtilities) Option Explicit ' used to generate a HTML page ' strOut must return a valid HTML Page Dim sValue Dim Dt Dim Dm Dim Intit Sub Generate (mgobjObj As MegaObject,Ctx As MegaWebSite,strIn As String,strOut As String) sValue = mgobjObj.GetProp("Date de modification") Dt=mid(sValue,9,2) & "/" & mid(sValue,6,2) & "/" & mid(sValue,1,4) Dm=CDate(Dt) if Dm >= date()-15 then Intit = mgobjObj.GetProp("Nom court","Display") if strIn = "Diagramme" then if instr(mgobjObj.GetProp("Nom"),"(") > 0 then Intit = mid(mgobjObj.GetProp("Nom"),1,instr(mgobjObj.GetProp("Nom"),"(") -1 ) else Intit = "" end if end if if Intit <> "" then strOut= "<TR><TD><img src=" & chr(34) & mgobjObj.GetObjectPicture & chr(34) & "/> <a href=" & chr(34) & Lcase(mgobjObj.GetProp("_HexaIdAbs")) & ".htm" & chr(34) & " target=" & chr(34) & "_top" & chr(34) & "> " & Intit & "</a></TD> <TD>" & Dm & "</TD>" & "</TR>" end if end if End Sub
I don't know if this method is the GOOD method
‎15-10-2015 03:23 PM
ok,
I have read this topic but my problem is to compute : (&CurentDate - 15 days) and put the résult as a date in the clause where of the SELECT. exemple : SELECT [Processus organisationnel] where [Date de modification] <= &CurentDate -15
The macro who buil the select is :
Sub Generate(oObject, oContext, sUserData, sResult)
sValue = oObject.GetProp("Comment","Display")
sResult = "Select [Processus organisationnel] where [Date de modification] >=" & chr(34) & date()-15 & chr(34)
End Sub
thank you for your response
‎15-10-2015 03:02 PM
Hello JFF
Certain system variables can be used in ERQL queries
See KB http://community.mega.com/t5/custom/page/page-id/mega-kb-solution?sid=50120000000mqO1AAI
Note also that a query can be based on a VB script macro. You can then use system variables of VB script language.