Previous Topic: CreateMIFString - Create a String AttributeNext Topic: GetMIFInteger - Retrieve the Value of an Integer Attribute


GetMIFComponent or GetComponent - Retrieve the Component Name

Valid on UNIX and Windows

GetMIFComponent or GetComponent retrieves the component name of an existing .MIF or Inv file.

This MIF and Inv file function has the format:

GetMIFComponent(Filename as string) as string
GetComponent(Filename as string) as string
Filename

Specifies the file name of the MIF file to retrieve the component from.

On successful completion, the function returns a string containing the component name; otherwise, it returns an empty string.

Example: GetMIFComponent function

Note: The initialization control for the following example can be found in the CreateMIFGroup example.

The following is an example of the GetMIFComponent, GetMIFInteger, GetMIFString, GetMIFValue, and SetMIFValue functions.

Dim file, gname, aname as string
Dim gid as integer

ClrScr()
file = "h:\test\miffus\file.mif"

Print("Component of """ + file + """: """ + GetMIFComponent(file) + """")

gname = "Strings"
gId = 1
aname = "string_1"
Print(gname + "." + aname + " = " + GetMIFString(file, gname, gId, aname, 1))
aname = "string_2"
Print(gname + "." + aname + " = " + GetMIFValue(file, gname, gId, aname, 2))

if SetMIFValue(file, gname, gId, aname, 2, "Text_new") then
	Print(gname + "." + aname + " = " + GetMIFValue(file, gname, gId, aname, 2))
else
	Print("1. SetMIFValue failed.")
	exit
endif

gname = "Numbers"
gId = 2
aname = "number_1"
Print(gname + "." + aname + " = " + Str(GetMIFInteger(file, gname, gId, aname, 1)))
aname = "number_2"
Print(gname + "." + aname + " = " + GetMIFValue(file, gname, gId, aname, 2))
if SetMIFValue(file, gname, gId, aname, 2, "999999") then

Print(gname + "." + aname + " = " + GetMIFValue(file, gname, gId, aname, 2))
else
	Print("2. SetMIFValue failed.")
	exit
endif