cancel
Showing results for 
Search instead for 
Did you mean: 

Validating the Data in Excel before uploading

Former Member
0 Kudos

Hi all,

I have a requirement where i need to uplaod an excel file from the users local system to Server.

But before saving i want to do certain validation on the Excel file which the user is trying to upload.

1. Is the Excel file in the same format as expected . ie the coloumn order , all the required coloumns etc

2. is there a possibility for me to check if certain coloumn values are mandatory .

Can you please guide me providing some docs on coloumn validation of the Excel.

Thanks,

Swetha

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Swetha,

First you have create one Value Node that node having 5 attributes. For Example you excel having 5 Columns data So you can create 5 attributes under value Node.

Can u see below Code.

IPrivateASNFileUplaodView.IASNDetails_PopUpNode node = wdContext.nodeASNDetails_PopUp();

IPrivateASNFileUplaodView.IASNDetails_PopUpElement ele;

if(node.size() > 0)

{

for(int i =0;i <node.size();i++)

{

ele = node.getASNDetails_PopUpElementAt(i);

if(ele.getOpn_Quantity() != null )

{

flag = true; //wdComponentAPI.getMessageManager().reportException(ele.getQuantity()+"val",true);

}

else

{

flag = false;//wdComponentAPI.getMessageManager().reportException("else-c1",true);

break;

}

if(ele.getPo_Number() != null && ele.getPo_Number().length() != 0 )

{

flag = true; //wdComponentAPI.getMessageManager().reportException(ele.getPlant()+"val",true);

}

else

{

//wdComponentAPI.getMessageManager().reportException("else-c2",true);

flag = false;

break;

}

if(ele.getPo_Item() != null && ele.getPo_Item().length() != 0 )

{

flag = true; //wdComponentAPI.getMessageManager().reportException(ele.getMaterialNumber()+"val",true);

}

else

{

flag = false;//wdComponentAPI.getMessageManager().reportException("else-c3",true);

break;

}

}

}

if(flag)

{

wdThis.wdGetCO_ASNFileUplaodController().executeYmm_Sc_File_Upload_02_Input();

wdComponentAPI.getMessageManager().reportSuccess("File Upload Sucessfully");

}

else

{

wdComponentAPI.getMessageManager().raiseException("Please fill in all the values in Excel sheet and Upload Again.",true);

}

By using this code Validating the Data in Excel before uploading .

Hope this is help full for you Swetha,

Regards

Vijay Kalluri

Former Member
0 Kudos

Hi Vijay,

i have gone through some of your posts ..my requirements are pretty close to your req .

may be we can share more info in the due course of time.

thanks.