【发布时间】:2015-04-17 16:59:23
【问题描述】:
这是非常基本的,但我正在努力尝试从键值映射中构建/检索值。例如,给定变量 X 和 Y 其中 X=123abc,Y=foo 在第一次执行和 X=456def, Y=bar 在第二次执行时,我希望有一个键值映射,其中 [123abc] -> [foo]和 [456def] -> [bar]。
但是,当我尝试使用 X 的任一值检索变量 Z 中的值时,我总是得到最后一个添加的值:Z=bar。如果我删除密钥 X=456def,检索密钥 X=123abc 会返回密钥不存在的错误。
我的猜测是只有一个值被构建到地图中,并且它被放入为“”,就好像没有设置变量一样。覆盖值“true”将其替换为最后添加的值。我确信该变量有一个值,因为它在跟踪中的先前策略执行中正确显示。
语法中有什么东西吗?有什么想法吗?
我正在使用以下策略来构建密钥
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations mapIdentifier="map1" enabled="true" continueOnError="false" async="false" name="buildmap1">
<DisplayName>build map1</DisplayName>
<FaultRules/>
<Properties/>
<ExclusiveCache>false</ExclusiveCache>
<ExpiryTimeInSecs>-1</ExpiryTimeInSecs>
<InitialEntries/>
<Put override="true">
<Key>
<Parameter>ref="X"</Parameter>
</Key>
<Value ref="Y"></Value>
</Put>
<Scope>organization</Scope>
</KeyValueMapOperations>
我正在使用以下方法来检索密钥
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations mapIdentifier="map1" enabled="true" continueOnError="false" async="false" name="getmap1">
<DisplayName>get map1</DisplayName>
<FaultRules/>
<Properties/>
<ExclusiveCache>false</ExclusiveCache>
<ExpiryTimeInSecs>-1</ExpiryTimeInSecs>
<InitialEntries/>
<Get assignTo="Z">
<Key>
<Parameter>ref="X"</Parameter>
</Key>
</Get>
<Scope>organization</Scope>
</KeyValueMapOperations>
【问题讨论】:
标签: apigee