Valid on UNIX and Windows
The SetMIFValue function changes the value of a specific attribute in a MIF file.
Function format:
SetMIFValue(Filename as string, GroupName as string, AttrName as string, Value as string) as Boolean
SetMIFValue(Filename as string, GroupID as integer, AttrID as integer, Value as string) as Boolean
SetMIFValue(Filename as string, GroupName as string, GroupID as integer, AttrName as string, AttrID as integer, Value as string) as Boolean
Specifies the filename of the MIF file
Specifies the name of the group in which the attribute is located.
Specifies the ID of the group in which the attribute is located.
Specifies the name of the attribute to be set.
Specifies the ID of the attribute to be set.
Specifies the value to set the attribute to in the MIF file.
To assign a new integer to an integer attribute code:
- value="123456"
To assign a new string, the string must be enclosed in additional quotes; otherwise, a subsequent MIF function may produce unexpected results:
- value="""123456"""
If the attribute specified is found in the MIF file, its value is changed and SetMIFValue returns TRUE; otherwise, returns FALSE.
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
|
Copyright © 2014 CA Technologies.
All rights reserved.
|
|