cancel
Showing results for 
Search instead for 
Did you mean: 

using macro generating the SELECT used in HTML [Component=] tag

Solved
Highlighted
jff
New Contributor

using macro generating the SELECT used in HTML [Component=] tag

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

 

4 Replies
MEGA

Re: using macro generating the SELECT used in HTML [Component=] tag

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.

Jerome
jff
New Contributor

Re: using macro generating the SELECT used in HTML [Component=] tag

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

jff
New Contributor

Re: using macro generating the SELECT used in HTML [Component=] tag

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) & ">&nbsp;" & Intit & "</a></TD> <TD>" & Dm & "</TD>" & "</TR>"
    end if
  end if
End Sub

I don't know if this method is the GOOD method

 

jff
New Contributor

Re: using macro generating the SELECT used in HTML [Component=] tag

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) & ">&nbsp;" & Intit & "</a></TD> <TD>" & Dm & "</TD>" & "</TR>"
    end if
  end if
End Sub