Howto add a variable number of characters in a field based on the length of character

المشرف العام

Administrator
طاقم الإدارة
How can I write a python script that does the following:

field(x) of type text field(y) of type text

I want to populate field(y) with contents of field(x) by first computing the length of the string in field(x). Based on the length of field(x) I want to add a certain number of the same characters (let us say A). The length of field(x) always has to be 8 characters long.

An example:

field(y) len(y) field(x) 20 2 AAAAAA20 1450 4 AAAA1450

I am able to do this manually by first calculating the len(y), filter by len(y) concatenate with the corresponding number of character of A.



أكثر...
 
أعلى