Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. unid:= @Text(@DocumentUniqueID);
  2.  
  3. theField := @Prompt([OkCancelList]; "Change Field"; "Select Field"; ""; "":"*new field*":@DocFields);
  4. isNewField := @If(theField="*new field*";"1";"0");
  5. theField := @If(theField="*new field*";
  6. @Prompt([OkCancelEdit]; "New field name"; "Name of the new field"; "fieldname");theField);
  7.  
  8.  
  9. currValueTemp:= @If( @IsAvailable(theField); @GetDocField(unid; theField); isNewField="1" &theField!="";""; "errorTemp" );
  10. currValue:= @If( @IsError(currValueTemp); "errorValue"; @Implode(@Text(currValueTemp);"~") );
  11. theValue := @Prompt([OkCancelEdit]; "Change field"; "New value: use '~' separator for lists (*remove* to remove the field)."; currValue);
  12.  
  13. currTypeSingle:= @If( @IsNumber(currValueTemp); "Number"; @IsTime(currValueTemp); "Time"; "Text" );
  14. currType:= currTypeSingle + @If(@Elements(currValueTemp)>1;" List";"");
  15.  
  16. theType := @If(theValue="*remove*";"Text";
  17. @Prompt([OkCancelList]; "Change field"; "Data Type"; currType; "Text" : "Time" : "Number" : "Text List" : "Number List" : "Time List"));
  18.  
  19. @If(
  20. theValue = "*remove*";
  21. @SetField(theField; @DeleteField);
  22.  
  23. theType = "Time";
  24. @SetField(theField; @TextToTime(theValue));
  25.  
  26. theType = "Number";
  27. @SetField(thefield; @TextToNumber(theValue));
  28.  
  29. theType = "Text List";
  30. @SetField(theField; @Trim(@Explode(theValue;"~")));
  31.  
  32. theType = "Number List";
  33. @SetField(theField; @TextToNumber(@Explode(@Trim(@ReplaceSubstring(theValue;" ";""));"~")));
  34.  
  35. theType = "Time List";
  36. @SetField(theField; @TextToTime(@Explode(theValue;"~")));
  37.  
  38. @SetField(theField; @Text(theValue))
  39. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement