这是非常基本的,但我努力尝试从keyvaluemap构建/检索值。例如给定变量X和Y,其中X = 123abc,第一次执行时Y = foo,第二次执行时X = 456def,Y = bar,我希望有一个键值映射,其中[123abc] - > [foo]和[456def] - > [bar]。Apigee - 键值映射 - 使用可变键的问题
但是,当我尝试检索变量Z中的值时,使用任何一个X值,我总会得到最后一个增加的值: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>
请在此链接添加一些上下文。 “鼓励与外部资源的链接,但请在链接中添加上下文,以便您的同行用户了解它是什么以及为何存在。总是引用重要链接中最相关的部分,以防目标网站无法访问或永久离线。“从[如何回答](http://stackoverflow.com/help/how-to-answer) – Cecilia