Data Types అంటే ఏమిటి? Apex లో Data Types పూర్తి వివరాలు | Salesforce Telugu

Data Types అంటే ఏమిటి? Apex లో Data Types ఎందుకు ఉపయోగిస్తారు? | Salesforce Apex in Telugu
📂 Salesforce Apex 🟢 Beginner 📘 Apex Daily

Data Types అంటే ఏమిటి? Apex లో Data Types ఎందుకు ఉపయోగిస్తారు?

Salesforce Apex in Telugu | String, Integer, Decimal, Boolean, Date, Datetime — అన్నీ ఒకే చోట

గత Blog లో Variables అంటే ఏమిటి? అనే Topic గురించి పూర్తిగా తెలుసుకున్నాం.

ఒక Variable లో Data ని Store చేయాలంటే ముందు ఒక విషయం తెలుసుకోవాలి. ఆ Variable లో ఎలాంటి Data Store చేయబోతున్నాం? పేరు Store చేస్తామా? Number Store చేస్తామా? Date Store చేస్తామా? లేదా True / False Store చేస్తామా?

ఈ విషయాన్ని Apex కి చెప్పడానికి ఉపయోగించేదే Data Type. ఈ రోజు అదే Concept ని చాలా సులభంగా అర్థం చేసుకుందాం.

ముందుగా ఒక చిన్న ఉదాహరణ చూద్దాం

మీ ఇంట్లో Kitchen లో నాలుగు Containers ఉన్నాయని అనుకోండి.

  • ఒక Container లో బియ్యం పెడతారు.
  • మరో Container లో పప్పు పెడతారు.
  • ఇంకో Container లో పంచదార పెడతారు.
  • మరొక Container లో ఉప్పు పెడతారు.

అన్ని వస్తువులను ఒకే Container లో వేస్తే ఎలా ఉంటుంది? గందరగోళం అవుతుంది.

Programming లో కూడా అలాగే ఉంటుంది. ప్రతి రకమైన Data ని Store చేయడానికి ప్రత్యేకమైన Data Type ఉంటుంది.

Data Type అంటే ఏమిటి?

💡 Definition Variable లో ఎలాంటి Data Store చేయబోతున్నామో Apex కి చెప్పేదే Data Type.

సులభంగా చెప్పాలంటే... Variable లో ఏ రకమైన Value ఉంటుందో చెప్పే గుర్తింపు Data Type.

Data Types ఎందుకు అవసరం?

ఒక Example చూద్దాం. మీ పేరు...

Value
Ramesh

ఇది Number కాదు. ఇది Text. కాబట్టి దీనిని String లో Store చేయాలి.

మీ వయసు...

Value
25

ఇది Text కాదు. ఇది Number. కాబట్టి దీనిని Integer లో Store చేయాలి.

Apex లో ఎక్కువగా ఉపయోగించే Data Types

ఈ రోజు మనం Beginners కి అవసరమైన ముఖ్యమైన Data Types మాత్రమే నేర్చుకుందాం.

  • String
  • Integer
  • Decimal
  • Boolean
  • Date
  • Datetime

వీటినే మీరు ఎక్కువగా ఉపయోగిస్తారు.

1 String

Text Store చేయడానికి ఉపయోగిస్తారు.

Apex
String studentName = 'Ramesh';

System.debug(studentName);
Output
Ramesh

పేరు, City, Email, Company Name వంటి Text Values అన్నీ String లో Store చేస్తారు.

2 Integer

Whole Numbers Store చేయడానికి ఉపయోగిస్తారు.

Apex
Integer age = 25;

System.debug(age);
Output
25

Age, Quantity, Count వంటి Values Integer లో Store చేస్తారు.

3 Decimal

Decimal Numbers Store చేయడానికి ఉపయోగిస్తారు.

Apex
Decimal salary = 45000.75;

System.debug(salary);
Output
45000.75

Salary, Price, Discount, Tax వంటి Values కి Decimal ఉపయోగిస్తారు.

4 Boolean

Boolean లో రెండు Values మాత్రమే ఉంటాయి.

  • true
  • false
Apex
Boolean isActive = true;

System.debug(isActive);
Output
true

User Active ఉన్నాడా? Payment Complete అయిందా? Record Approved అయ్యిందా? ఇలాంటి Questions కి Boolean ఉపయోగిస్తారు.

5 Date

Date మాత్రమే Store చేయడానికి ఉపయోగిస్తారు.

Apex
Date joiningDate = Date.today();

System.debug(joiningDate);
Output
Today's Date

Joining Date, Birth Date, Expiry Date వంటి వాటికి Date ఉపయోగిస్తారు.

6 Datetime

Date మరియు Time రెండూ Store చేయడానికి ఉపయోగిస్తారు.

Apex
Datetime currentTime = Datetime.now();

System.debug(currentTime);
Output
Current Date and Time

Login Time, Created Time, Last Modified Time వంటి వాటికి Datetime ఉపయోగిస్తారు.

Real Time Salesforce Example

ఒక Employee Details Store చేస్తున్నామని అనుకోండి.

Apex
String employeeName = 'Ravi';

Integer employeeAge = 28;

Decimal salary = 65000.50;

Boolean isPermanent = true;

Date joiningDate = Date.today();

ప్రతి Information కి వేర్వేరు Data Type ఉపయోగిస్తున్నాం.

తప్పు Data Type ఉపయోగిస్తే ఏమవుతుంది?

ఈ Code చూడండి.

Wrong
Integer studentName = 'Ramesh';
⚠️ Error వస్తుంది ఎందుకంటే Integer లో Text Store చేయలేము.

సరైన Code...

Correct
String studentName = 'Ramesh';

ఎలా గుర్తుంచుకోవాలి?

Data Data Type
NameString
CityString
AgeInteger
SalaryDecimal
ApprovedBoolean
Birth DateDate
Login TimeDatetime

ఈ Table గుర్తుపెట్టుకుంటే చాలా Easy.

గుర్తుంచుకోవాల్సిన విషయాలు

  • ప్రతి Variable కి Data Type తప్పనిసరి.
  • Text కోసం String.
  • Whole Numbers కోసం Integer.
  • Decimal Numbers కోసం Decimal.
  • True లేదా False కోసం Boolean.
  • Date కోసం Date.
  • Date మరియు Time కోసం Datetime.

Interview Questions

Data Type అంటే ఏమిటి?

Answer

Variable లో ఎలాంటి Data Store చేయబోతున్నామో తెలిపేదే Data Type.

Text Store చేయడానికి ఏ Data Type ఉపయోగిస్తారు?

Answer

String

True లేదా False Store చేయడానికి ఏ Data Type ఉపయోగిస్తారు?

Answer

Boolean

Salary Store చేయడానికి Integer ఉపయోగించవచ్చా?

Answer

లేదు. Salary లో Decimal Values ఉండే అవకాశం ఉంది కాబట్టి Decimal ఉపయోగించాలి.

Practice Task

ఈ Programs Run చేయండి. Debug Log లో ప్రతి Value ని Observe చేయండి.

Program 1

String courseName = 'Salesforce Apex';

System.debug(courseName);

Program 2

Integer experience = 3;

System.debug(experience);

Program 3

Decimal courseFee = 4999.99;

System.debug(courseFee);

Program 4

Boolean isCertified = false;

System.debug(isCertified);

Conclusion

ఈ రోజు మనం Data Types గురించి తెలుసుకున్నాం. Programming లో ఇది చాలా ముఖ్యమైన Concept.

మీరు ఏ Data ని Store చేస్తున్నారో దానికి సరైన Data Type ఉపయోగించడం చాలా అవసరం. తర్వాత వచ్చే Topics అయిన Operators, Conditions, Loops, Collections వంటి వాటిలో కూడా ఈ Data Types ని ఉపయోగిస్తాం.

కాబట్టి ఈ రోజు చెప్పిన ప్రతి Data Type ని Practice చేయండి.

🎯 ఇంకా మరింత లోతుగా Apex నేర్చుకోవాలనుకుంటున్నారా?

ఈ Blog ద్వారా మీరు Apex Concepts ను సులభంగా అర్థం చేసుకోవచ్చు. కానీ చదవడం మాత్రమే కాకుండా, Practice చేస్తూ నేర్చుకుంటేనే నిజమైన Coding Skills వస్తాయి.

అందుకే నేను SFDC Telugu లో పూర్తి Salesforce Apex Course (తెలుగులో) రూపొందించాను. ఈ Course లో ప్రతి Concept ను Step by Step గా, Real Time Examples తో, Coding రాని వారికీ కూడా అర్థమయ్యే విధంగా వివరించాను.

ఈ Course ద్వారా మీరు...

  • Apex Code ఎలా రాయాలో నేర్చుకుంటారు.
  • Code ని చదివి సులభంగా అర్థం చేసుకునే సామర్థ్యం పెరుగుతుంది.
  • Real Time Scenarios పై Practice చేస్తారు.
  • Interview లో వచ్చే Coding Questions కి ధైర్యంగా Answer చెప్పగలుగుతారు.
  • మీ స్వంతంగా Apex Programs రాయగల స్థాయికి చేరుకుంటారు.
📹 Apex Course సంబంధించిన Video Link క్రింద ఇవ్వబడింది. ఒక్కసారి Video చూసి Course Structure మీకు నచ్చితే Website లో నుండే Purchase చేయవచ్చు.

Payment పూర్తయిన వెంటనే Course కి Instant Access వస్తుంది. వెంటనే Learning ప్రారంభించవచ్చు.

Happy Coding! 🚀 — SFDC Telugu | Apex Daily Series

Post a Comment

1 Comments

  1. Excellent explanation! The topic is presented in Telugu in a very simple and easy-to-understand way. The examples make the concepts clear, and the step-by-step approach is especially helpful for beginners learning Salesforce Apex.

    ReplyDelete