分享知识、分享快乐

专注于企业业务流程管理平台;构建企业级协作和流程管理平台
目前博客已经迁往畅想网:
http://blog.vsharing.com/sharepoint
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Working with Lists

Posted on 2007-01-08 22:08  kevinocean  阅读(272)  评论(0编辑  收藏  举报

@Trim("Apples" : "" : "Oranges") returns "Apples" : "Oranges".

@Replace takes three parameters, sourcelist, fromlist and tolist. The goal is to replace, in the sourcelist, any instances of the values in the fromlist with the corresponding values in the tolist

Remove one or more items from a list

FruitList := "Apples" : "Cantaloupes" : "Oranges" :

"Grapefruit";

YuckList := "Cantaloupes" : "Grapefruit";

GoodFruit := @Trim(@Replace(FruitList; YuckList; ""))

The result of this code is as follows:

GoodFruit := "Apples" : "Oranges"

Replace an item with a different item

REM {Define labels and corresponding fields in order};

labels := "Field One":"Field Two":"Field Three":"Field

Four":"Field Five";

fields := "Field1":"Field2":"Field3":"Field4":"Field5";

REM {Prompt user for label of field to change};

labelchoice := @Prompt([OkCancelList] : [NoSort]; "Choose

Field"; "Choose the field you wish to change...";

@Subset(labels; 1); labels);

REM {Determine corresponding field to change};

fldchoice := @Trim(@Replace(labelchoice; labels; fields))

Return a list of items that appear in two different lists

FruitList1 := "Apples" : "Bananas" : "Lemons" : "Oranges" :

"Grapes";

FruitList2 := "Bananas" : "Blackberries" : "Tangerines" :

"Apples";

REM "Remove the items from list1 that are also in list2";

NOTlist := @Trim(@Replace(FruitList1; FruitList2; ""));

REM "Now that we know what isn't common in list1 with list2,_

we can easily figure out what is common by removing what

isn't common.";

CommonList := @Trim(@Replace(FruitList1; NOTList; ""))

Return a list of items that do not appear in either of two lists

dbserver := @Subset(@DbName; 1);
dbpath := @Subset(@DbName; -1);

@thisname

choice := @PickList([Custom] : [Single]; "";

"CONCAT_EX.By.Company.PL"; "Choose Contact"; "Please choose a

contact on which to base this contact."; 4);

REM {Company + "~" + Name + "~" + @Implode(Address; "^") +

"~" + City + "~" + State + "~" + ZIP};

FIELD Company := @Word(choice; "~"; 1);

FIELD Address := @Explode(@Word(choice; "~"; 3); "^");

FIELD City := @Word(choice; "~"; 4);

FIELD State := @Word(choice; "~"; 5);

FIELD ZIP := @Word(choice; "~"; 6)