Okay so my question is two parts:
I retrieve from a webservice about 10 relevant IDs and Names based on the given parameter. Is their a way to convert the response into some list?
The response is like :
ID1:XXX - Name1: test1 - Address1: Narnia - Gender1: M
ID2:YYY - Name2: test2 - Address2: Hogwarts - Gender2: NA
The second part:
How do I fill in a gridview from the retrieved list above? And have like certain conditioning like if Address is Hogwarts I'd have an extra column (ex: Desc: ) Where you fill it in your house name or if the house Address is N\A then the Desc column becomes mandatory to be filled in.
Related
I am retrieving data from OData (v.3) API, and displaying it in a table, in console:
Item Name Price Difference
aaa 10 0
bbb 2 8
ccc 5 -3
Item Name and Price are properties retrieved from the API. Difference is the difference I am calculating between the price of one item retrieved and the price of the next item retrieved. I do not need to modify the data in the API, only export the data in table in JSON format, with each item having Difference as a property.
How is it possible to add the Difference property to the entity? I've googled a lot, and most questions deal with modifying data in the API and similar.
http://bytefish.github.io/TinyCsvParser/sections/quickstart.html
how can we identify on the basis of value in first column to run the mapper of any specific class.
Like if value in first column is "Person" then it should be mapped with class A.
and if value is "Marks" then it should be mapped with class B
For Code - http://pastebin.com/JSiwF5hy
Two issues here-
1. Suppose if we get data in csv like :
P,Jack,Australia,a#a.com;
C,abc Pvt, Australia
Data is of Person or Company based on value in 1st column like P and C.
How to implement this without loading the file again.
As in the class structure, emailAddress comes under ContactDetails class. How to implement this functionality.
I have a flat file with the following columns
SampleID Rep_Number Product Protein Fat Solids
In the flat file SampleID and Product are populated in the first row only, rest of the rows only have values for Rep_Number, Protein, Fat, Solids. SampleID and Product are blank for the rest of the rows. So my task is to fill those blank rows with the first row that has the sampleID and Product and load into the table.
So task is to pick the first non null SampleID and Product from the flat file and put them in a variable. And rest is all configured. If I can pick the first non null SampleID and Product directly from the flat file and put into their respective variables I can take it from there. That is all I need.
I can connect a script component to flat file source in a data flow task. I need help with the script to pick the first non null values (SampleID and Product),
Need help please. Thanks in advance.
If you are sure you need to store the data of the 1st row - 1st 2 columns' values in variables and take it from there, and DO NOT REQUIRE a change in your original approach, then try this:
You need to have a NEW variable to keep track of the ROW COUNT. Let this be an integer and set it to 0. This will help process only the first row and skip the rest. Let's call this Row_Count
After you retrieve data from the component connected to flat file as the source, connect it to a 'Script Component' and click 'Edit'.
In the 'Script Transformation Editor'click the 'Input Columns' on the left and select the desired columns (say Column_Name1 and Column_Name2) you want to retrieve the value from (i.e. 1st and 2nd)
Click 'Script' on the left
Under 'Custom Properties', expand the 'ReadWriteVariables'. Add the 2 variables you intend to use for storing the values AND the Row_Count variable.
Click 'Edit Script.
In the editor that opens, double click 'ScriptMain.vb' on the right.
Under the Public Overrides Sub PostExecute() {} procedure type this:
If Variables.Row_Count = 0 Then
Variables.Your_Variable1 = Row.Column_Name1
Variables.Your_Variable2 = Row.Column_Name2
Variables.Row_Count= Variables.Row_Count + 1
End If
You have the desired values in your variables, proceed with the rest of your logic.
Note:
If you do not add the variables to the 'ReadWriteVariables', you will not be able to access them in the script.
Based on any other code you might add in the script, you would need to include additional headers if they are not present.
Please mark my post as answer if it helps :)
I hava a database which only have 2 table Object , User ,
Obviously user table has information about all user and the object table have millions of records
ObjectTable
Id (int)
Text1 (nvarchar(max))
Text2 (nvarchar(max))
I am trying to make a translator , first of all i put all data in database like following
1 : Good , Well
2 : Bad , NotWell
3 : Man , Husband Of Women
if suppose i havae 2 text boxes in my site user enter following text
Good Bad Man
then i will split that string on space and then i will have an array of string now i will took first element of array and go to server to find that wheather there is any match of Good in my database if i found match then i will replace that value with that Text2 like we have Well for Good which took too much time to translate and sometime it gives Request Timed Out . So , what is the best way to deal with it
You do not provide a lot of information to help you about your timeout problem.
Only things I can tell you are :
first of all, check that there are indexes on your Text1 and Text2 columns. If not, add it
look at your sql query. It should be SELECT * FROM OBJECT WHERE TEXT1='Good' (maybe add a top 100 to avoid returning to many things with LIKE ).
For the index to run smoothly, there should be no function called on column TEXT1 (like uppercase or trim). If you use a like, it should be TEXT1 LIKE 'good%' (% at the end)
if you use a like, beware of not returning your whole table on a empty entry, % or _ entry ( LIKE '%', LIKE '%%', LIKE '_%' can be bad things)
why use nvarchar(max) if you are just storing words ?
don't forget to sanitize your entries to avoid sql injection
My problem is:
I got data in the front end in this format :
Username : xxxx
First name : xxx
Last Name : XXX
Authorizations \this is a grid, with chheckbox and radiobtns
Domain Role
xyz User
bnv Admin
asd User_1
now I need to insert this data back to my table .
1 suggestion i got was : Use XML ... right track ? or is there some better way ( haven't worked with XML....yet :))
If I understood correctly, you want to insert bulk data to the database. Apart from XML you can also use SqlBulCopy class which is very efficient in inserting millions of records to the SQL database. You can find more details on this at MSDN
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx