Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unid:= @Text(@DocumentUniqueID);
- theField := @Prompt([OkCancelList]; "Change Field"; "Select Field"; ""; "":"*new field*":@DocFields);
- isNewField := @If(theField="*new field*";"1";"0");
- theField := @If(theField="*new field*";
- @Prompt([OkCancelEdit]; "New field name"; "Name of the new field"; "fieldname");theField);
- currValueTemp:= @If( @IsAvailable(theField); @GetDocField(unid; theField); isNewField="1" &theField!="";""; "errorTemp" );
- currValue:= @If( @IsError(currValueTemp); "errorValue"; @Implode(@Text(currValueTemp);"~") );
- theValue := @Prompt([OkCancelEdit]; "Change field"; "New value: use '~' separator for lists (*remove* to remove the field)."; currValue);
- currTypeSingle:= @If( @IsNumber(currValueTemp); "Number"; @IsTime(currValueTemp); "Time"; "Text" );
- currType:= currTypeSingle + @If(@Elements(currValueTemp)>1;" List";"");
- theType := @If(theValue="*remove*";"Text";
- @Prompt([OkCancelList]; "Change field"; "Data Type"; currType; "Text" : "Time" : "Number" : "Text List" : "Number List" : "Time List"));
- @If(
- theValue = "*remove*";
- @SetField(theField; @DeleteField);
- theType = "Time";
- @SetField(theField; @TextToTime(theValue));
- theType = "Number";
- @SetField(thefield; @TextToNumber(theValue));
- theType = "Text List";
- @SetField(theField; @Trim(@Explode(theValue;"~")));
- theType = "Number List";
- @SetField(theField; @TextToNumber(@Explode(@Trim(@ReplaceSubstring(theValue;" ";""));"~")));
- theType = "Time List";
- @SetField(theField; @TextToTime(@Explode(theValue;"~")));
- @SetField(theField; @Text(theValue))
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement