Docusign SDK error in placing "sign_here" tabs in particular document - python-3.x

I am using python SDK version 3.3 and I am trying to place tabs using anchor string. My use case is sending multiple documents through a single envelope to multiple recipients.
For recipient 1, the anchor string in document 1 is (let us say) “Sign here” and anchor string in document 2 is “Assessee”.
For recipient 2, the anchor string in document 2 is “Sign here”.
Now when I am anchoring tabs, I am passing the recipient id , document id and the anchor string, I even tried by parsing the page number. Docusign seems to be searching for anchor string across all the documents.
For example: I get a error message saying “Assessee” is not found, but I specifically mentioned "Assessee" for document 2. What am I missing here? Please help
----- Snippet -----
sign_here1 = docusign.SignHere(anchor_string='Sign here',
recipient_id='1',
document_id= '1',
anchor_units='inches',
anchor_y_offset='0.6',
anchor_x_offset='0.5',
anchor_ignore_if_not_present=False
)
sign_here2 = docusign.SignHere(anchor_string='Assessee',
recipient_id='1',
document_id= '2',
anchor_units='inches',
anchor_y_offset='0.6',
anchor_x_offset='0.5',
anchor_ignore_if_not_present=False
)
sign_here3 = docusign.SignHere(anchor_string='Sign here: ',
recipient_id='2',
document_id= '2',
anchor_units='inches',
anchor_y_offset='0.6',
anchor_x_offset='0.5',
anchor_ignore_if_not_present=False
)
----- Error message -----
"errorCode":"ANCHOR_TAB_STRING_NOT_FOUND","message":"The specified Anchor Tab string was not found in the document. Anchor Tab String \"Assessee\" not found."This is the output, I recieve. But I have mentioned only document_id '2' in sign_here2

Your code has :
anchor_string='Assessee'
This means DocuSign scans the document and looks for this word. If the word cannot be found - this tab cannot be placed.
The idea of an anchor string is to find how to place the tab based on some text, a few characters, a word or something in the document.
Since, you also have x_position and y_position, maybe you misunderstood how tab positioning work? you typically have one or the other.
there's an offset you can use for the anchor, but that's different that x_position.
Try to just remove the anchor_string and see what happens.

Related

How would I isolate a string between two strings in DiscordJS?

I've currently been using this script:
var portion = body.substring(
str.lastIndexOf('ID Background',") + 1,
str.lastIndexOf('ID Theme',")
);
"Body" is the input, "Portion" being the output.
I'm trying to isolate text between the words strings "ID Background" and "ID Theme"
Example:
ID Background
Background information Background information Background information Background information
ID Theme
Theme information Theme information Theme information Theme information Theme information
...Et Cetera.
Expected Output:
Background information Background information Background information
Current Output:
undefined
I cannot figure out why this script is not working. I'm using this for a Discord bot (Discord.JS)
You should use RegExp capturing groups ()
// objective: get everything in between 'start' and 'end'
const str = 'start hello how was your day end';
// capture everything in between the two words in parentheses
console.log(str.match(/start (.*) end/)[1]);
Since you're example uses line breaks, which the special character . doesn't cover, you should use [\s\S] (\s is whitespace, and \S is anything but whitespace. Together, they cover everything. Also, use optional chaining ? so that your code doesn't throw a TypeError if no match is found.
var portion = body.match(/ID Background *([\s\S]*) *ID Theme/)?.[1];
if (!portion)
// no match found...

Find and replace text and wrap in "href"

I am trying to find specific word in a div (id="Test") that starts with "a04" (no case). I can find and replace the words found. But I am unable to correctly use the word found in a "href" link.
I am trying the following working code that correctly identifies my search criteria. My current code is working as expected but I would like help as i do not know how to used the found work as the url id?
var test = document.getElementById("test").innerHTML
function replacetxt(){
var str_rep = document.getElementById("test").innerHTML.replace(/a04(\w)+/g,'TEST');
var temp = str_rep;
//alert(temp);
document.getElementById("test").innerHTML = temp;
}
I would like to wrap the found word in an href but i do not know how to use the found word as the url id (url.com?id=found word).
Can someone help point out how to reference the found work please?
Thanks
If you want to use your pattern with the capturing group, you could move the quantifier + inside the group or else you would only get the value of the last iteration.
\ba04(\w+)
\b word boundary to prevent the match being part of a longer word
a04 Match literally
(\w+) Capture group 1, match 1+ times a word character
Regex demo
Then you could use the first capturing group in the replacement by referring to it with $1
If the string is a04word, you would capture word in group 1.
Your code might look like:
function replacetxt(){
var elm = document.getElementById("test");
if (elm) {
elm.innerHTML = elm.innerHTML.replace(/\ba04(\w+)/g,'TEST');
}
}
replacetxt();
<div id="test">This is text a04word more text here</div>
Note that you don't have to create extra variables like var temp = str_rep;

document-wide ordered lists in ascii doctor

I would like to define a new style of ordered lists in asciidoctor that is composed of a fixed uppercase letter and a counter that increments. It has to be document wide. For example
A1. first item
A2. second item
some text
A3. third item
the flow of the text continues
The solution I came up with is as follows, which is heavy and not 100% satisfactory.
[horizontal]
A{counter:ol1}.:: first item
A{counter:ol1}.:: second item
some text
[horizontal]
A{counter:ol1}.:: third item
the flow of the text continues
Is there a simpler solution ? Is there a possibility at least to define a macro that would expand to A{counter:ol1}.::?
You have a couple of choices:
Create a macro in your editor that inserts the required markup (assuming that your goal is to reduce the amount of typing to achieve this effect).
Adjust the markup to specify a custom role and drop the counter:
= My document
:docinfo: shared
[horizontal, role=numbered]
A:: first item
A:: second item
some text
[horizontal, role=numbered]
A:: third item
the flow of the text continues
Then add some custom CSS, via a docinfo file (see: https://asciidoctor.org/docs/user-manual/#docinfo-file), that does the counting for you. This won't work in PDF output.
body {
counter-reset: myli;
}
.hdlist.numbered .hdlist1::after {
content: counter(myli) ". ";
counter-increment: myli;
}

How to get first word from sentence in Swift

I am trying to get first word from String sentence as variable. How to do that? I have Local notification and I need to use it's message first word as variable, is it possible? For LocalNotifications I use LocalNotificationHelper library for easier handling. Maybe there is logic problem but I do not think so. More like I do not know enough options in Swift language.
Edit: I also have the nameField.text! in NSUserDefaults as an array. I need to delete the message first word from that array. Right now I remove only the first object from that array but that is not solution for me because I need to delete the nameField.text! from that array when LocalNotification pops out and user click on button.
Here I create notification message:
LocalNotificationHelper.sharedInstance().scheduleNotificationWithKey("text", title: "see options(left)", message: nameField.text!+"some text", date: deadlinePicker.date, userInfo: userInfo)
Now I need the message:nameField.text! to be variable at app launch.
This is how I trigger notification button actions:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "someFunction:", name: IDENTIFIER, object: nil)
Swift 3
let sentence = "First word needed"
let word = sentence.components(separatedBy: " ").first
print(word) // First
You can split your sentence using the white space char and then extracting the first element.
let sentence = "What a wonderful world"
if let firstWord = sentence.characters.split(" ").first.map(String.init) {
print(firstWord) // "What"
}

Sharepoint list internal name creation policy

i have a list lets call it as
List1
in List1 list i have fields like the following
List1
ID
Title
....
also i have List2 and its columns like the following
List2
ID
Title
Type
now i added a lookup field from List2 to List1 and now my List1 columns becomes
List1
ID
Title
List2
List2:Title
when i look at the List2:Title i see its internal name is List2_x003a_Title
i easily can understand that ':' is represented as x003a
ie the hex code of ':' is x003a
after than i deleted column and readded it. oooooo
what i see is that the field added with the same external name but this time its INTERNAL NAME
List2_x003A_Title
can someone explain the reason. when the hex code is x003a or x003A
SharePoint internal name creation policy: the name is encoded to a valid XML name according to the XML specification.
Any XML name character that does not conform to the XML 1.0 spec (fourth edition) recommendation is escaped as _xHHHH_. The HHHH string stands for the four-digit hexadecimal UCS-2 code for the character in most significant bit first order. For example, the name Order Details is encoded as Order_x0020_Details.
.NET Framework contains XmlConvert.EncodeName Method that converts the name to a valid XML name. This method guarantees the name is valid according to the XML specification.
Example:
var fieldName = XmlConvert.EncodeName("Order Details"); //returns Order_x0020_Details

Resources