I have a field in the database for Name and for LastName, then I have a page with a label intended to display the full name.
I can display the full name in this page by binding the label to:
#datasource.item.Name + '.' + #datasource.item.LastName
(an example output would be: John.Richarson)
BUT, I instead of displaying the full name and last name, I just want to display the first three characters of the Name and LastName
(In this example, I would like to display: Joh.Ric)
How can I define it in the binding properties? Thank you.
Since you can use a lot of the Javascript functions like .join() and .slice(), etc., I would suggest incorporating that into your binding. The only thing to remember is that when using a binding in conjunction with a Javascript function, the binding itself needs to be inside parenthesis. So:
(#datasource.item.Name).slice(0,3) + '.' + (#datasource.item.LastName).slice(0,3)
Related
For a Netsuite account, I have noticed the entityid for a customer (the customer ID on the UI) appears as an alphanumeric value using the organisation's customer number format.
However, in a saved search, it appears in the following format,'ACC12345 Parent entity name: ACC67895 Child entity name'. I am trying to use a formula to get the child entity's customer ID number from this text string.
The following formula mostly works in a saved search to extract the child entity's customer ID number (i.e. the 'ACC67895 ' in the above example
SUBSTR({entityid},INSTR({entityid},'ACC',1,2),8)
Is there a way to replace the 8 in this formula with another formula so that it extracts everything from the second 'ACC' onwards until the first blank ' '?
The number of characters of the customer ID varies so I don't want to use 8 as a hard coded value in the formula.
Thanks
I would suggest having your first SUBSTR return everything from the start of the child customer's ID to the end, then nest that inside a second SUBSTR which would use an INSTR to find the space after the ID and cut off everything after that:
SUBSTR(SUBSTR({entityid},INSTR({entityid},'ACC',1,2)),1,INSTR(SUBSTR({entityid},INSTR({entityid},'ACC',1,2)),' '))
Ugly, but it works.
I have created a regex lookup table variable to output text based on the Click Element containing a specific string. However, the variable appears as null despite the string definitely being in the Click Element. Can anyone help?
Here is my regex lookup table variable
Here is the debug window showing null (the Action field is where the regex table variable should populate)
Here is the full tag that contains the variable
Here is the trigger for the tag
I have tried various different strings from the Click Element, without luck.
The trigger for the tag is based on the same string, and the trigger works, which only adds to my confusion.
I feel like the problem must be obvious, but I'm at a loss.
I struggled with this as well until I realized that "Click Element" is actually an object, not a string. It's based on gtm.element in the datalayer.
So, in order to do this you'll need to create a custom datalayer variable that more accurately targets a specific child key.
To see what I mean, open a link in a new tab and then type in datalayer into your browser console, and press enter. You'll see something like:
3:
event: "gtm.click"
gtm.element: a#mylinkclass.my-class.something.else
accessKey: ""
ariaAtomic: null
ariaAutoComplete: null
ariaBusy: null
ariaChecked: null
ariaColCount: null
ariaColIndex: null
etc....
Screenshot of chrome inspector console showing datalayer children
So, then you'll have to create custom variable to target the key you'd like. For example, a datalayer variable that you create with gtm.element.className would return my-class something else for link Link Text.
Using this method I was able to create a Regex lookup table just like you're trying to do.
Here's a post that goes into some more detail on some of the above:
https://www.analyticsmania.com/post/click-element-variable-in-google-tag-manager/
In a Drupal content type a need to get the output of a field partly unvisible. These are bank account details, the IBAN.
Normally the field shows 1234567. I need to get xxxx567. I need to show only the last 3 numbers/letters.
Also I need this output in field edit form.
On the display end you could change the output using a simple PHP function in the theme template by grabbing a substring of the field's last three digits and concatenating it with "xxxx" before printing.
You might also consider doing this at the formatter level by using the 'custom formatter' module perhaps?
https://drupal.org/project/custom_formatters
To do this on the edit screen is trickier. I suppose you could do a hook form alter to use PHP to change the field value, but I am afraid you will rewrite the field value when you save the node with the 'xxxx' instead of the real data.
I wonder if it would make sense to 1.) hide the actual field, 2.) create a dummy field that displays the text formatted as "xxxx567" to the user, and 3.) write some javascript that populates the hidden field with the visible field's value if it is changed. Presumably the form would still throw values if the hidden field did not meet formatting requirements.
As a bonus to the project I'm currently working on, the people would like it if I could change the background color of individual table cells depending on what their value is. So in the RadGrid_ItemDataBound event handler I have, I'm trying to set the BackColor of the cell if the cell's text equals a certain value from a dataset in my database. My current code is like so:
For i As Integer = 0 To ds2.Tables(0).Rows.Count - 1 Step 1
If tc.Text = ds2.Tables(0).Rows(i)("LookupValue") Then
tc.BackColor = ds2.Tables(0).Rows(i)("Ref1")
Exit For
End If
Next
The problem is when setting a color in the code-behind, I apparently have to set it to an object of System.Drawing.Color -- I can't just feed it a string value like I can in CSS. So in the code snippet I've posted above, my code throws a runtime exception on tc.BackColor = ds2.Tables(0).Rows(i)("Ref1"). I've also discovered that I can't use CType to change a string value into an equivalent object of System.Drawing.Color .
I've thought of a solution that I COULD use. I could create a custom object that has a Name property and a System.Drawing.Color property. I could instantiate several objects according to all color values available in the database and then compare the cell text against the objects' Name properties, however I fear doing this will be rather resource-intensive (and this application's performance is already taking a hit because it has to run under IE7).
So does anybody know of a way I could pull off what I need to here in a relatively simple, non-resource-intensive fashion?
Color.FromName() handing it the name in your database. There are also other methods like FromRGB, but FromName sounds like what you want.
http://msdn.microsoft.com/en-us/library/system.drawing.color.fromname.aspx
How to search every word separated by comma in textbox
Please refer above post
Its Working perfectly...But i have small issues.. when i enter in text box like c,c++,4-5 yrs it have to check in database like either c,c++ skills and 4-5 yrs experiecne and then the reult has to be shown... Burt as per ur query it just show results whether any one of keyword satisfy database ...I want to compare year also how? –
If you want that behavior, you have to program that behavior. One design is to have multiple input boxes: one where you check if any of the words exist, another where you check that all of the words exist. (Perhaps even another for an exact phrase match.) Another design possibility would be for you to develop a syntax to indicate optional and required words all within a single input box. The point is it is up to you.
After you've decided on a design, then you could write code that builds your query based on or matches on the optional words and and matches on the required. Something like this pseudocode
Select * From Table Where
(Field Like OptionalWord1 Or Field Like OptionalWord2 Or Field Like OptionalWord3)
And Field Like RequiredWord1
And Field Like RequiredWord2
(etc.)