前のトピック: SetLocalPath - UAM の[ジョブ ローカル パス]フィールドへの文字列のコピー次のトピック: その他の関数


SetMIFValue - 属性値の変更

UNIX および Windows で有効です。

SetMIFValue 関数は、MIF ファイルの特定の属性の値を変更します。

関数の形式

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
Filename

MIF ファイルのファイル名を指定します。

GroupName

属性が属しているグループの名前を指定します。

GroupID

属性が属しているグループの ID を指定します。

AttrName

設定する属性の名前を指定します。

AttrID

設定する属性の ID を指定します。

Value

MIF ファイル内の、属性を設定する値を指定します。

整数属性コードに新しい整数を割り当てるには、以下のようにします。

- value="123456"

新しい文字列を割り当てるには、文字列を追加引用符で囲む必要があります。そうしないと、以降の MIF 関数によって予期せぬ結果が生じることがあります。

- value="""123456"""

指定した属性が MIF ファイルにある場合、値は変更され、SetMIFValue は True を返します。それ以外の場合は、False を返します。

例:

以下に、GetMIFComponent、GetMIFInteger、GetMIFString、GetMIFValue、および SetMIFValue 関数の例を示します。

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