This site requires JavaScript to be enabled

Tosca Version
IncidentLookup using list
How can we help?

Solution Suggestions

Please enter your question to get suggestions.
Boolean Operators
OR or vertical bar symbol (|)
Finds a match if either the terms exist in a document (a union using sets).
Finds a match if both terms exist in a document (an intersection of sets).
NOT, minus (-), or exclamation point (!)
Excludes documents that contain the term after NOT (a difference of sets).
Asterisk (*)
The asterisk symbol performs a multi character wildcard search.
Percent sign (%)
The percent sign performs a single character wildcard search.
Quotation marks (")
Use quotation marks to search for an exact phrase with multiple terms.
For examples and more information look at our Knowledge Base: Advanced Search On The Support Portal


I have a file that expects a fixed number of characters for every field. If the input characters are less than expected, trailing spaces are to be added at the end to meet the expected count.

Example, Field size: 30.

Input: This is a test statement. (char count: 25).

I have to add 30-25= 5 spaces at the end. How can I do it through Tosca? I need to know which command/sendkeys can be used for padding those extra spaces to my input string.


Thanks in advance.

2 0

David Hämmerle

Created: 2019-05-09 10:42:35

Hi Aayush,

there is a way but it will require a few TestSteps and a loop.

First, you need to buffer the field size and the actual length of your string. The latter can be achieved using the dynamic expression {CALC[LEN(""""yourString"""")]} in a Set Buffer TestStep.

Afterwards, you can calculate the difference between the field size and the string length and buffer it. Then create a Repetition Folder and put a Set Buffer TestStep there. The Name of the TestStepValue is set to the buffer name storing your string. In the Value column, put the Buffer there and add one trailing whitespace (this is not visible in the screenshot below).

Since this is a Repetition Folder, use the difference calculated earlier to define how often the TestStep should be repeated.

I hope this helps. Kind regards!

0 0

Aayush Gupta

Created: 2019-05-09 11:01:36

Hi David.

This works like a charm!

I was using the excel function REPT earlier but that was leading to a mismatch of characters by 1 (not sure why). That problem is solved with your suggested solution. Thanks!

0 0

Shiba Prasad Sahoo

Created: 2019-05-27 12:19:24

Best Solution for this Requirement in One Step :

Val : ABCDEF     (say , its the value you want to pad space on right)

{B[Val]}{RANDOMREGEX["[" "]{"{MATH[30-{CALC[len(""""{B[Val]}"""")]}]}"}"]}

Result :"ABCDEF                        "


Tosca is the perfect solution

Optimize - Manage - Automate

Download Trial