Skip to main content

Actionfield with IdeaScript

and again...

Actionfield is a really nice toy to play with...

here is a short example

Sub Run_Actionfield

      'declaration
      '-----------

Dim sTableActionfieldMaster As String
Dim sTableActionfieldDetail As String
Dim sJoinFieldMasterDetail As String

sTableActionfieldMaster = ""
sTableActionfieldDetail = ""
sJoinFieldMasterDetail = ""    
    
sTableActionfieldMaster = Dir(Client.Workingdirectory + "MasterTableName.IMD")
sTableActionfieldDetail = Dir(Client.Workingdirectory + "DetailTableName.IMD")    

'Be careful:
'The JoinKey must exists in both tables !!!!!!!!!!!!!!!
'---------------------------------------
sJoinFieldMasterDetail = "JoinKeyNumeric"


Set db = Client.OpenDatabase(sTableActionfieldMaster)
Set table = db.TableDef

'sometimes it is better to first get as StringField (otherwise idea raise an error)
'and than the JoinKey Field (most times numeric)
'---------------------------------------------
Set field = table.GetField("StringField")
Set field = table.GetField(sJoinFieldMasterDetail)

'here is the point where the magic starts...
'---------------------------------
field.SetActionFieldForExtraction sTableActionfieldDetail, sJoinFieldMasterDetail, "", "", "", "", "", "", ""
db.Close    
    
Set db = Nothing
Set task = Nothing
Set field = Nothing
sTableActionfieldMaster = ""
sTableActionfieldDetail = ""
sJoinFieldMasterDetail = ""


End Sub


that's it....

@brian:
would it be possible to deactivate the trim function when using plain text in your forum?

cheers,
chris

Brian Element Sun, 04/06/2014 - 14:16

In reply to by groldi

I just tried it and I I couldn't get it to work in V9.1.1, let me know if you can get it to work.  If not send a message to your IDEA distributor and I can send a message to IDEA here in Ottawa letting them know the problem.

groldi Sun, 04/06/2014 - 15:12

It could get it to work in V 9.1.
Please check your PM.
I will post the final Version of the code later in this thread.